Skip to main content
Every message in Baileys goes through a single method: 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 the text field.

Quote / reply

Pass the original WAMessage 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 the WAMessage object from your store and pass it as forward. WhatsApp handles the forwarding label automatically.

Location message

Send a pin on the map by providing degreesLatitude and degreesLongitude.

Contact message (vCard)

Build a standard vCard string and wrap it in the contacts object. You can include multiple contacts in the same message by adding more entries to the contacts array.

Reaction message

Pass the key 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 its key. Set type to 1 to pin and 0 to unpin. The time field controls how long the pin lasts.

Poll message

Create a poll with a name, an array of option strings, and the number of options a voter can select. Set toAnnouncementGroup to true when posting to a community announcement group.
Poll votes are encrypted. To read them, listen for messages.update and use getAggregateVotesInPollMessage. Set getMessage in your socket config to improve poll vote decryption reliability.
By default, WhatsApp Web does not generate link previews. Baileys can generate them for you, but you must first install the optional dependency:
Once installed, send a message with a URL in the 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 attach ephemeralExpiration to any individual message to make only that message disappear.
1

Enable disappearing messages for a chat

2

Send a single disappearing message

3

Disable disappearing messages for a chat