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.
Message is the object passed to your onMessage and onCommand handlers. It wraps a raw baileys.WAMessage and pre-resolves fields that would otherwise require extra look-ups: sender LID, text content, media metadata, mentions, and the full quoted message chain. Action methods such as reply(), react(), edit(), and delete() use the bot’s active socket automatically so you never need to reference bot.sock directly in most handlers.
Constructor
Message instances are constructed internally by WABotJS when a
messages.upsert event fires. You do not normally call this constructor
directly. The quoted property is also a Message instance, constructed
recursively from the context info embedded in the raw message.The raw Baileys
WAMessage object. raw.key.id and raw.key.remoteJid
must be non-null strings or the constructor throws.The owning
Bot instance. Used for JID resolution, socket access, and cache
look-ups during field extraction.Properties
id
raw.key.id). Use this to reference the message in reactions, deletions, and edits.
chat
'12345678@g.us'). For direct messages WABotJS attempts to resolve the JID to a LID, falling back to the phone-number JID if the LID is not yet in cache.
sender
participant / remoteJid fields and the JID cache. undefined for edge cases where the sender cannot be determined (e.g. server messages). For messages sent by the bot itself, this is the bot’s own LID.
text
undefined when the message carries no text content (e.g. a bare sticker or a reaction).
mentions
contextInfo.mentionedJid. Phone-number JIDs are resolved to LID JIDs via the bot’s JID cache wherever possible. Empty array if no mentions are present.
timestamp
raw.messageTimestamp. Falls back to Math.floor(Date.now() / 1000) if the field is absent.
type
'conversation', 'extendedTextMessage', 'imageMessage', 'videoMessage', 'audioMessage', 'documentMessage', and 'stickerMessage'. undefined when raw.message is absent.
mimetype
'image/jpeg', 'video/mp4', 'audio/ogg; codecs=opus'). undefined for non-media messages.
hash
fileSha256) of the encrypted media file as a Buffer. Used to verify integrity after download. undefined for non-media messages.
key
mediaKey) as a Buffer. Required to decrypt the downloaded media stream. undefined for non-media messages.
url
URL object from which the encrypted media blob can be downloaded. undefined for non-media messages. Use download() rather than fetching this URL directly — WABotJS handles decryption for you.
path
directPath string (e.g. /v/...). Used internally by Baileys when constructing download requests. undefined for non-media messages.
quoted
Message instance from the contextInfo.quotedMessage field. undefined when the message is not a reply. Accessing quoted.quoted gives you the message that the quoted message itself was replying to, and so on.
Methods
isFromMe
true if the message was sent by the bot’s own account (raw.key.fromMe === true).
isGroup
true if m.chat is a group JID (ends with @g.us).
toRaw
baileys.WAMessage object. Use this when you need to pass the raw message to a Baileys API that does not accept a Message instance.
download
Buffer. Throws if url, key, or path are undefined (i.e. the message is not a downloadable multimedia message):
reply
m.chat quoting the current message. Returns the sent message as a new Message instance, or undefined if Baileys did not return a message object.
Any Baileys message content object —
{ text }, { image, caption },
{ video }, { audio }, etc.Additional Baileys send options such as
ephemeralExpiration. The quoted
option is set automatically to the current message.react
'' to remove an existing reaction.
A single emoji character (e.g.
'👍'), or '' to un-react.read
bot.sock.readMessages([raw.key]) internally.
delete
Message instance, or undefined.
edit
isFromMe() returns false — only the bot’s own messages can be edited.
The new message content. Typically
{ text: 'new text' }.Additional Baileys send options.