Every message in Baileys goes through a single method:Documentation Index
Fetch the complete documentation index at: https://whiskeysockets-docs-jids-socket-config-ptbr.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
sock.sendMessage(jid, content, options?). The jid is the WhatsApp ID of the recipient, content is an AnyMessageContent object describing the message type, and the optional options parameter accepts MiscMessageGenerationOptions for things like quoting, disappearing messages, and timestamps.
See the full list of content types in the AnyMessageContent type alias and all available options in the MiscMessageGenerationOptions type alias.
Non-media messages
Text message
The simplest message sends a plain string in thetext field.
Quote / reply
Pass the originalWAMessage object as quoted in the options to thread a reply beneath it. This works with all message types.
Mention a user
Include the@number mention in the text and list the full JIDs in mentions. The @ prefix in the text is optional but recommended so WhatsApp highlights the mention in the UI.
Forward a message
Retrieve theWAMessage object from your store and pass it as forward. WhatsApp handles the forwarding label automatically.
Location message
Send a pin on the map by providingdegreesLatitude and degreesLongitude.
Contact message (vCard)
Build a standard vCard string and wrap it in thecontacts object. You can include multiple contacts in the same message by adding more entries to the contacts array.
Reaction message
Pass thekey of the message you want to react to. Use an empty string for text to remove an existing reaction.
Pin message
Pin or unpin a message by passing itskey. Set type to 1 to pin and 0 to unpin. The time field controls how long the pin lasts.
| Duration | Seconds |
|---|---|
| 24 hours | 86400 |
| 7 days | 604800 |
| 30 days | 2592000 |
Poll message
Create a poll with a name, an array of option strings, and the number of options a voter can select. SettoAnnouncementGroup to true when posting to a community announcement group.
Link previews
By default, WhatsApp Web does not generate link previews. Baileys can generate them for you, but you must first install the optional dependency:text field — Baileys detects the URL automatically and fetches preview metadata.
Disappearing messages
Send a protocol message to enable or disable disappearing messages in a chat, or attachephemeralExpiration to any individual message to make only that message disappear.
| Duration | Seconds |
|---|---|
| Remove | 0 |
| 24 hours | 86400 |
| 7 days | 604800 |
| 90 days | 7776000 |