Message Sent Event
Documentation for the message.sent webhook event
The message.sent event is sent when a message leaves your business for a customer, on any channel.
It is the outbound counterpart of message.received.
Event Type
message.sentWhen It's Triggered
Once for each message sent to a customer on Messenger, Instagram, WhatsApp, the website widget, mobile or email, whoever sent it.
The source field tells you who that was:
source | Sent by |
|---|---|
ai_agent | The AI agent |
member | A teammate in the inbox |
follow_up | A follow-up rule |
ticket_rating | The automatic request for a ticket rating |
order_notification | An automatic order-status email |
org_api | Your own system, through the Messaging API |
external | Someone outside our app, such as in Meta Business Suite, the WhatsApp Business App or Gmail |
Some things to know:
- Sent does not mean delivered.
The event means the channel accepted the message, or that we pushed it to the widget or the mobile app.
A channel can still fail to deliver it later.
Use
message.readto learn that a customer saw it. - Some events arrive about 30 seconds late.
Most are sent straight away.
When Meta tells us about a Messenger or Instagram message before our own send has finished saving it, we wait so that
sourceandactorare complete. Replies made outside our app on those two channels always wait. - Events can arrive out of order.
A
message.reador a customer's reply can reach you before themessage.sentfor the message it follows. Useatto put them in order. externalcan occasionally be wrong. A Messenger or Instagram send that takes longer than that 30-second wait to save can be reported asexternal.- Each file and caption is its own event.
A file group sends one event per file, with its own
messageIdandeventId. A caption on Messenger, on Instagram or with WhatsApp audio goes out as a separate text message, so it has its own event too. - It is not sent for failed sends, or for old messages imported by a WhatsApp history sync. Public replies to comments and voice calls are not included either.
- A delivery can be lost if our server restarts while it is waiting or sending. This event is for notifications and syncing, so don't use it as your only record of what was sent.
If you reply to customers from a message.sent handler, skip your own sends first.
Otherwise each reply triggers another event and your system loops.
Ignore events where source is org_api and actor.orgApiKeyId is your key's ID.
Subscribing to This Event
Open Settings → Webhooks and check Message Sent.
This event carries what your business said to your customers, so it has two requirements:
- The URL must be
https. - The webhook must have a signing secret. Webhooks created in the dashboard always have one.
A webhook that doesn't meet both receives nothing for this event, including retries and resends.
Webhook Payload Structure
{
"event": "message.sent",
"timestamp": "2026-10-31T08:00:00.412Z",
"data": {
"eventId": "7b1e4c52-3f0a-8d19-a6c4-0e9f2b7d1c3a",
"messageId": "msg_9Xp4rTn2",
"platformMessageId": "wamid.HBgNODgwMTcwMDAwMDAwMBUCABEYEjA",
"conversationId": "conv_abc123",
"platform": "WHATSAPP",
"channelId": "112233445566778",
"platformUserId": "8801700000000",
"customerName": "Jane Doe",
"type": "TEXT",
"text": "Your order has shipped",
"attachments": [],
"replyTo": null,
"email": null,
"botEnabled": true,
"ticketId": "ticket_abc123",
"inboxUrl": "https://app.example.com/inbox/all/conv_abc123",
"at": "2026-10-31T08:00:00.000Z",
"source": "org_api",
"actor": {
"memberId": null,
"orgApiKeyId": "key_abc123",
"label": "agent@yourcompany.com"
}
}
}Field Descriptions
| Field | Type | Description |
|---|---|---|
eventId | string (UUID) | Stable ID for this message, shared by retries and resends, so use it to deduplicate |
messageId | string | Our ID for the message: the messageId returned when you sent it through the Messaging API |
platformMessageId | string | null | The channel's own ID for the message, null on the website widget and mobile, and usually null on email sent from our app because the mail provider reports it later |
conversationId | string | The conversation |
platform | string | MESSENGER, INSTAGRAM, WHATSAPP, WEB, MOBILE or EMAIL |
channelId | string | null | Your Page, Instagram account, WhatsApp number, widget, app or mailbox ID |
platformUserId | string | The customer's ID on that channel |
customerName | string | null | Display name, when the channel gave us one |
type | string | TEXT, IMAGE, VIDEO, AUDIO, FILE, STICKER, LINK or EMOJI |
text | string | null | The message text, or on WhatsApp media the caption sent with the file |
attachments | array | The files sent, each with type, url, mimeType, fileName and size |
replyTo | object | null | The message this one quotes, as messageId and platformMessageId |
email | object | null | Email only: subject, from, to, cc and html, never bcc |
botEnabled | boolean | Whether the AI agent is on for this conversation |
ticketId | string | null | The ticket this message belongs to |
inboxUrl | string | null | A link to the conversation in the inbox |
at | string (ISO 8601) | When we saved the message |
source | string | Who sent it, as listed in the table above |
actor.memberId | string | null | The teammate who sent it |
actor.orgApiKeyId | string | null | The API key that sent it |
actor.label | string | null | The actorLabel your system passed when it sent the message |
Verifying the Request
Check every request before you trust it. Reject anything that fails either check:
- The signature.
Compute the HMAC-SHA256 of the raw request body with your webhook's secret, and compare it with the
X-Webhook-Signatureheader in constant time. Use the raw bytes as received, because parsing and re-serializing the JSON can change them. - The age.
The signature covers
timestamp, so a captured request can't be given a new time. Reject a request older than about 5 minutes to stop it being replayed. Retries are sent with a newtimestampand a new signature, so they still pass.
import crypto from 'crypto';
import express from 'express';
const MAX_AGE_MS = 5 * 60 * 1000;
function isValid(rawBody, signature, secret) {
const expected = Buffer.from(
crypto.createHmac('sha256', secret).update(rawBody).digest('hex'),
);
const received = Buffer.from(signature ?? '');
return (
received.length === expected.length &&
crypto.timingSafeEqual(received, expected)
);
}
app.post(
'/webhooks/messages',
express.raw({ type: 'application/json' }),
(req, res) => {
const signature = req.headers['x-webhook-signature'];
if (!isValid(req.body, signature, process.env.WEBHOOK_SECRET)) {
return res.status(401).end();
}
const { event, timestamp, data } = JSON.parse(req.body);
if (Date.now() - new Date(timestamp).getTime() > MAX_AGE_MS) {
return res.status(401).end();
}
res.status(200).end();
if (event === 'message.sent') {
// Deduplicate on data.eventId, then handle the message.
}
},
);Retries
Failed deliveries are retried up to 6 times, as for
message.received.
Deduplicate on data.eventId.