Beyond sending new messages, Baileys gives you methods to manage the lifecycle of messages: deleting them for all participants, editing previously sent content, marking messages as read, and broadcasting your presence state (typing, recording, online) to a chat.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.
Delete a message for everyone
Pass thekey of the message you want to remove inside a delete content object. This removes the message for all participants in the chat.
To delete a message only for yourself (not for other participants), use
sock.chatModify with the clear operation instead. See the chat management page for details.Edit a message
Pass the updated content along with theedit field set to the key of the original message. You can include any editable content type in the same call.
Mark messages as read
Baileys requires you to mark individual message keys as read explicitly — you cannot mark an entire chat read in one call. This means you need to track the keys of unread messages yourself (for example, by storing them in your data store as they arrive).WAMessage using message.key.id.
Update presence
CallsendPresenceUpdate to broadcast your current state to a specific chat. This is how WhatsApp shows “typing…” or “recording audio…” indicators.
presence argument accepts the following values from the WAPresence type:
| Value | Meaning |
|---|---|
available | You are online |
unavailable | You are offline |
composing | You are typing a message |
recording | You are recording a voice note |
paused | You stopped typing (typing paused) |
If a desktop client is active, WhatsApp does not send push notifications to your phone. Mark your Baileys client as offline using
sock.sendPresenceUpdate('unavailable') if you want push notifications to reach your phone while the bot is running.