Event Types and Payload
When an event occurs, Hub Chatt2.me makes a POST to your endpoint with a JSON payload. This page describes the payload structure for each event type.
Message event
Fired when a user sends a message to one of your channels.
General payload fields
| Field | Type | Description |
|---|---|---|
eventType | string | Always Message |
channelId | string | UUID of the channel that received the message (use as from when replying) |
messageId | string | Unique ID of the received message |
from | string | Sender's identifier in the channel (use as to when replying) |
timestamp | number | Unix timestamp of when the message was sent by the user |
channel | string | Channel name: whatsapp, instagram, messenger, telegram, sms |
content | object | Content of the received message |
Example — Text message received
{
"eventType": "Message",
"channelId": "6cbd6789-1d2b-47e0-9391-5eb91d2839ea",
"messageId": "abc123de-f456-789a-bcde-f01234567890",
"from": "5511993986082",
"timestamp": 1700000000,
"channel": "whatsapp",
"content": {
"type": "text",
"text": "Hello, I'd like to know more about your products"
}
}
Example — Interactive button reply
{
"eventType": "Message",
"channelId": "6cbd6789-1d2b-47e0-9391-5eb91d2839ea",
"messageId": "def456gh-1234-5678-abcd-901234567890",
"from": "5511993986082",
"channel": "whatsapp",
"content": {
"type": "interactive",
"interactive": {
"type": "button_reply",
"button_reply": {
"id": "SUPPORT",
"title": "Support"
}
}
}
}
Example — Shared location
{
"eventType": "Message",
"content": {
"type": "location",
"location": {
"latitude": -23.5505,
"longitude": -46.6333
}
}
}
MessageStatus event
Fired when the status of a message you sent is updated.
| Field | Type | Description |
|---|---|---|
eventType | string | Always MessageStatus |
messageId | string | ID of the message (returned when you sent it) |
status | string | New message status |
timestamp | number | Unix timestamp of the status event |
channel | string | Channel where the message was sent |
Possible statuses
| Status | Description |
|---|---|
sent | Sent to the channel server |
delivered | Delivered to the recipient's device |
read | Read by the recipient (when available in the channel) |
failed | Delivery failed |
Example — Message delivered
{
"eventType": "MessageStatus",
"messageId": "9307b9ab-5fab-4151-b7c2-b00c2a8a6e8e",
"status": "delivered",
"timestamp": 1700000060,
"channel": "whatsapp"
}
Example — Message read
{
"eventType": "MessageStatus",
"messageId": "9307b9ab-5fab-4151-b7c2-b00c2a8a6e8e",
"status": "read",
"timestamp": 1700000120,
"channel": "whatsapp"
}
Replying to the user from the webhook
When receiving a Message event, use the payload fields to build the reply:
Node.js — Auto-reply
app.post('/webhooks/chatt2me', async (req, res) => {
res.status(200).send('OK'); // Respond 200 first!
const { eventType, channelId, from, content } = req.body;
if (eventType === 'Message' && content?.text === 'hi') {
await fetch('https://api.chatt2.me/v1/communication/whatsapp/message', {
method: 'POST',
headers: {
'x-api-key': process.env.CHATT2ME_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
from: channelId, // UUID of the channel that received the message
to: from, // Identifier of the user who sent it
content: { text: 'Hello! How can I help you?' },
}),
});
}
});
Respond 200 before processing
Send 200 OK immediately upon receiving the webhook and process the logic afterwards (or in the background). This prevents timeouts and false errors in the webhook log.
Next steps
- Inspecting logs — view all received events and identify failures
- Retrying failures — resend events that failed