Event is triggered for incoming messages, to listen for both incoming and outgoing, please refer to messages.upsert.
Webhook Event: messages.received
This event is triggered when a new message is received in your session. The payload includes the message content, sender information, and message key.
See the code example below for a typical payload structure.
To learn more about handling media in this event, please refer to the help center article on handling media messages.
Code Examples
{
"event": "messages.received",
"timestamp": 1633456789,
"data": {
"messages":
{
"key": {
"id": "3EB0X123456789",
"fromMe": false,
"remoteJid": "[email protected]", // could also be 555555555@lid based on the addressingMode
"addressingMode": "pn",
"senderPn": "[email protected]",
"cleanedSenderPn": "1234567890",
"senderLid": "555555555@lid"
},
"messageBody": "Hello, I have a question",
"message": {
"conversation": "Hello, I have a question"
}
}
}
}