mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: add readMessages function
This commit is contained in:
19
README.md
19
README.md
@@ -521,16 +521,19 @@ await sock.sendMessage('1234@s.whatsapp.net', { forward: msg }) // WA forward th
|
||||
|
||||
## Reading Messages
|
||||
|
||||
A set of message IDs must be explicitly marked read now.
|
||||
Cannot mark an entire "chat" read as it were with Baileys Web.
|
||||
A set of message keys must be explicitly marked read now.
|
||||
In multi-device, you cannot mark an entire "chat" read as it were with Baileys Web.
|
||||
This does mean you have to keep track of unread messages.
|
||||
|
||||
``` ts
|
||||
const id = '1234-123@g.us'
|
||||
const messageID = 'AHASHH123123AHGA' // id of the message you want to read
|
||||
const participant = '912121232@s.whatsapp.net' // the ID of the user that sent the message (undefined for individual chats)
|
||||
|
||||
await sock.sendReadReceipt(id, participant, [messageID])
|
||||
``` ts
|
||||
const key = {
|
||||
remoteJid: '1234-123@g.us',
|
||||
id: 'AHASHH123123AHGA', // id of the message you want to read
|
||||
participant: '912121232@s.whatsapp.net' // the ID of the user that sent the message (undefined for individual chats)
|
||||
}
|
||||
// pass to readMessages function
|
||||
// can pass multiple keys to read multiple messages as well
|
||||
await sock.readMessages([key])
|
||||
```
|
||||
|
||||
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```.
|
||||
|
||||
Reference in New Issue
Block a user