Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jzszdznzzl/WABotJS/llms.txt
Use this file to discover all available pages before exploring further.
Socket is a thin typed wrapper around baileys.makeWASocket. It copies every property and method from the underlying baileys.WASocket instance onto itself at construction time, then provides typed async overrides for end() and logout() — the two methods whose signatures differ from the raw Baileys interface. All other Baileys methods (sendMessage, groupMetadata, readMessages, requestPairingCode, etc.) and all event emitter behaviour are inherited verbatim from the socket instance created by baileys.makeWASocket.
You do not instantiate Socket directly. Access it through bot.sock after calling bot.login().
Constructor
Socket is constructed by Bot.login() internally. The config object is
assembled by Bot from your Auth state, the fetched WhatsApp Web version,
browser fingerprint, message/metadata cache callbacks, and other options.
You do not call this constructor directly.The full Baileys socket configuration object. Passed directly to
baileys.makeWASocket(). Refer to the
Baileys documentation for the
complete list of supported fields.Overridden Methods
Socket provides typed async wrappers for two methods from the underlying WASocket where the original signatures are incompatible with WABotJS’s type interface.
end
WASocket.end(). Called by Bot.close() and Bot.login() when restarting the socket.
An optional
Error describing why the connection is being terminated. When
omitted the socket closes without a specific error code. Pass a boom.Boom
instance with statusCode: baileys.DisconnectReason.restartRequired to
trigger an immediate reconnect.logout
reason.message string (if provided) is forwarded to the underlying WASocket.logout(). Called by Bot.logout() automatically.
An optional
Error whose .message is forwarded to the Baileys logout
call. In practice this field is rarely needed in user code.Inherited from Baileys WASocket
Socket exposes the complete baileys.WASocket surface minus the two overridden methods above. The most commonly used members are listed below; consult the Baileys documentation for the full reference.
Messaging
Messaging
Groups
Groups
Authentication & pairing
Authentication & pairing
Event emitter (sock.ev)
Event emitter (sock.ev)
The Refer to the Baileys event reference
for the full list of events and their payloads.
ev property is the Baileys event emitter. WABotJS subscribes to several
events internally; you can subscribe to additional ones directly:User & auth state
User & auth state
Example
The most common reason to accessbot.sock directly is to send a message to a JID that is not in the context of an incoming message:
Calling
bot.sock.sendMessage() directly sends the message without quoting
any prior message. To send a quoted reply, use m.reply() from inside an
onMessage or onCommand handler — it sets the quoted option automatically.