WABotJS exposes message-action methods directly on theDocumentation 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.
Message object, so you can act on any incoming message with a single method call. For more control — such as starting a conversation in a chat where no message has arrived yet — you can also reach the underlying socket directly.
Replying to a Message
m.reply(content, options?) sends a message back to the same chat and quotes the original message, so recipients see the reply thread. It returns a Promise<Message | undefined> — the resolved value is a new Message representing the sent message, which you can then edit or react to.
content parameter is baileys.AnyMessageContent — see the Content Types section below for examples.
Sending to Any Chat
To send a message without quoting — or to initiate a message in a chat not triggered by an incoming event — usebot.sock.sendMessage(jid, content). bot.sock is the Socket instance that wraps the underlying baileys.WASocket.
bot.sock throws if accessed before bot.login() is called. Always access it inside a callback
(onOpen, onMessage, etc.) or after await bot.login() resolves.Reacting to a Message
m.react(emoji) sends an emoji reaction to the message. Pass the emoji as a string:
react() returns Promise<Message | undefined> — the reaction protocol message.
Editing a Message
m.edit(content, options?) edits a message that the bot itself sent. It throws an Error if m.isFromMe() is false, so it’s safe to call only on messages returned by reply() or other send operations.
The classic use-case — shown in the WABotJS test suite — is to send a placeholder, compute a result, then update the message in-place:
Deleting a Message
m.delete() revokes the message for everyone in the chat. Returns Promise<Message | undefined>.
Marking as Read
m.read() sends a read receipt for the message, moving it out of the “unread” state in the sender’s WhatsApp:
Content Types
All send and reply methods acceptbaileys.AnyMessageContent as the content argument. WABotJS re-exports the complete Baileys library, so you can import any Baileys type directly from wabotjs.
WABotJS re-exports the full Baileys library as a namespace. You can access Baileys types via:
import { baileys } from 'wabotjs' and then reference baileys.AnyMessageContent, or import
directly from baileys with import type { AnyMessageContent } from 'baileys'.