Message
Introduction to Messaging Webhook Events
This section describes the webhook events that are specific to managing messages in the Message system. These events are essential for tracking and responding to new messages, message updates, deletions, and status broadcasts.
Events
new.message
Structure
This event is triggered when a new message is received. It is essential for processing and responding to incoming messages in real time.
{
"event": "new.message", // Event name
"instance": { // Instance details
"owner": "[email protected]",
"name": "codechat",
"id": "d4a58666-9737-485d-988b-d18a43ce8c75"
},
"data": { // Message details
"header": { // Message header
"messageId": "0542F8EF37C48548301A9C957C33EB17",
"fromMe": false,
"wuid": "[email protected]",
"pushName": "pushName"
},
"body": { // Message body
"messageType": "conversation",
"message": "Test"
},
"context": { // Message context
"sourceDevice": "android",
"messageTimestamp": 1666479478,
"fromGroup": false
}
}
}
messages.update
Structure
This event notifies you when a message is updated, such as a change in read status.
{
"event": "message.update", // Event name
"instance": { // Instance details
"owner": "[email protected]",
"name": "codechat",
"id": "d4a58666-9737-485d-988b-d18a43ce8c75"
},
"data": { // Update details
"update": {
"status": "READ",
"header": {
"messageId": "3A8B7F4631EA2A840895",
"wuid": "[email protected]",
"fromMe": true
},
"dateTime": 1672002761941
}
}
}
messages.delete
Structure
{
"event": "messages.delete", // Event name
"instance": { // Instance details
"owner": "[email protected]",
"name": "codechat",
"id": "d4a58666-9737-485d-988b-d18a43ce8c75"
},
// Structure for deleting specific messages
"date": [
{
"messageId": "0542F8EF37C48548301A9C957C33EB17",
"fromMe": false,
"wuid": "[email protected]",
},
...
]
}
// Structure for deleting the entire chat
{
"event": "messages.delete",
"instance": {
"owner": "[email protected]",
"name": "codechat",
"id": "d4a58666-9737-485d-988b-d18a43ce8c75"
},
{
"wuid": "[email protected]",
"all": true
}
}
messages.set
Structure
This event sends a list of all your messages uploaded to WhatsApp. It is useful for synchronizing the current status of messages.
{
"event": "messages.set", // Event name
"instance": {
// Instance details
"owner": "[email protected]",
"name": "codechat",
"id": "d4a58666-9737-485d-988b-d18a43ce8c75"
},
"data": [ // List of messages
{
"header": {
"messageId": "0542F8EF37C48548301A9C957C33EB17",
"fromMe": false,
"wuid": "[email protected]",
"pushName": "pushName"
},
"body": {
"messageType": "conversation",
"message": "Test"
},
"context": {
"sourceDevice": "android",
"messageTimestamp": 1666479478,
"fromGroup": false
}
},
...
]
}
status.broadcast
Structure
This event notifies you when a contact posts a Status. It is important to keep track of contacts' status updates.
{
"event": "status.broadcast", // Event name
"instance": { // Instance details
"owner": "[email protected]",
"name": "codechat",
"id": "d4a58666-9737-485d-988b-d18a43ce8c75"
},
"data": { // Status details
"header": {
"messageId": "0542F8EF37C48548301A9C957C33EB17",
"fromMe": false,
"wuid": "[email protected]",
"pushName": "pushName"
},
"body": {
"messageType": "conversation",
"message": "Test"
},
"context": {
"sourceDevice": "android",
"messageTimestamp": 1666479478,
"fromGroup": false
}
}
}