Events
See how you will receive updates from whatsapp
There's a lib for nodejs here: Click here
Engine: baileys (JS)
You are viewing Baileys docs. Baileys uses camelCase method names (sendMessage, groupCreate) and JSON message shapes — see Non-Media/Media Messages examples below. Responses are JSON-serialized Baileys WAMessage objects. Persistence: Mongo connections-auth collection.
All webhook requests include 3 headers for verification:whats2api: trueuserId: your user's idconnectionId: the originating connection's id
Each webhook is a POST whose body is a map of eventName → payload. Baileys emits every event from its ev bus; credentials update events are filtered out before fanning out.
Example
Message upsert, where you should create, or update it:
List of events
The most important ones you should listen for:
- connection.update: connection state — WS closed, opened, connecting
- creds.update: credentials updated (filtered out before webhook fan-out)
- messaging-history.set: history sync, reverse chronological
- chats.upsert / chats.update / chats.delete: chat lifecycle
- labels.association / labels.edit: labels
- presence.update: presence of a contact in a chat
- contacts.upsert / contacts.update: contact changes
- messages.delete / messages.update / messages.media-update / messages.upsert / messages.reaction: message lifecycle
- message-receipt.update: read/delivered receipts
- groups.upsert / groups.update: group metadata changes
- group-participants.update: participant add/remove/promote
- blocklist.set / blocklist.update: blocklist
- call: call state updates