Skip to main content

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.

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.

Delete a message for everyone

Pass the key of the message you want to remove inside a delete content object. This removes the message for all participants in the chat.
const msg = await sock.sendMessage(jid, { text: 'hello word' })
await sock.sendMessage(jid, { delete: msg.key })
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 the edit field set to the key of the original message. You can include any editable content type in the same call.
await sock.sendMessage(jid, {
      text: 'updated text goes here',
      edit: response.key,
    });

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).
const key: WAMessageKey
// can pass multiple keys to read multiple messages as well
await sock.readMessages([key])
You can access the message ID from any WAMessage using message.key.id.

Update presence

Call sendPresenceUpdate to broadcast your current state to a specific chat. This is how WhatsApp shows “typing…” or “recording audio…” indicators.
await sock.sendPresenceUpdate('available', jid)
The presence argument accepts the following values from the WAPresence type:
ValueMeaning
availableYou are online
unavailableYou are offline
composingYou are typing a message
recordingYou are recording a voice note
pausedYou stopped typing (typing paused)
Presence updates expire after approximately 10 seconds. If you want to keep showing “typing…” you need to send repeated updates.
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.
For handling incoming calls, see Handle WhatsApp calls.