Skip to main content

Reading Messages

A set of message keys must be explicitly marked read now. You cannot mark an entire ‘chat’ read as it were with Baileys Web. This means you have to keep track of unread messages.

Mark Messages as Read

The message ID is the unique identifier of the message that you are marking as read. On a WAMessage, the messageID can be accessed using messageID = message.key.id.

Message Key Structure

The WAMessageKey contains the following properties:

Mark Chat Read/Unread

While you can’t mark an entire chat as read directly, you can use chatModify with the last message:
You need to provide lastMessages array containing message metadata with the key and messageTimestamp properties.

Tracking Unread Messages

Since Baileys requires explicit message keys to mark as read, you should implement your own unread message tracking:
The readMessages function is implemented in src/Socket/messages-send.ts and sends receipt acknowledgments to WhatsApp servers.