Message Received Event
Documentation for the message.received webhook event
The message.received event is sent for every message a customer sends to your
organization, on every connected channel.
Event Type
message.receivedWhen It's Triggered
The event is sent once for each incoming customer message on:
- Facebook Messenger (
MESSENGER) - Instagram Direct (
INSTAGRAM) - WhatsApp (
WHATSAPP) - The website chat widget (
WEB) - The Mobile Chat API (
MOBILE) - A connected mailbox (
EMAIL)
It is not sent for:
- Replies from the AI agent
- Replies from your team in the inbox
- Messages you send with the Messaging API
- Button taps on Messenger and Instagram (Get Started, a menu item, a postback button). Those
are sent as
message.postbackinstead, never as both - Messages Messenger or Instagram delivers while another app controls the conversation (Meta's handover protocol). We keep them in the inbox, but you can't reply to them until the conversation comes back, so no event is sent. You won't receive the messages from that period
- Reactions (
message.reaction), an ad or link click without a message (conversation.referral), and read receipts (message.read) - Facebook Page post comments, and phone calls
How attachments arrive depends on the channel. See Attachments by channel.
Use this event to:
- Show every channel in one helpdesk or agent console
- Copy conversations into your CRM as they happen
- Trigger your own automation when a customer writes
Subscribing to This Event
Open the Webhooks page and check Message Received in the events list.
Only webhooks with message.received selected receive these requests. The URL must be https and point at
a public address, because these deliveries carry your customers' messages.
Webhook Payload Structure
{
"event": "message.received",
"timestamp": "2026-10-07T09:14:03.250Z",
"data": {
"eventId": "5b0e7c1a-2f3d-8a8e-9c61-7d2e4f9a0b13",
"messageId": "msg_7Hq2kLm9",
"platformMessageId": "wamid.HBgNODgwMTcwMDAwMDAwMBUCABIYFjNFQjA",
"conversationId": "conv_abc123",
"platform": "WHATSAPP",
"channelId": "112233445566778",
"platformUserId": "8801700000000",
"customerName": "Jane Doe",
"type": "IMAGE",
"text": "Do you have this in blue?",
"attachments": [
{
"type": "IMAGE",
"url": "https://<your-domain>/app/api/whatsapp/media/1234567890?phoneNumberId=112233445566778",
"mimeType": null,
"fileName": null,
"size": null
}
],
"interaction": null,
"referral": {
"source": "ad",
"type": null,
"ref": null,
"adId": "120210000000000000",
"adTitle": "Summer sale",
"ctwaClid": "ARAkLkA8rmlFeiCktEJQ-QTwRiyYHAFDLMNDBH0CD3qpjd0HR4irJ6LEkR7JwFF4XvnO2E4Nx0-eM-GABDLOPaOdRMv-_zfUQ2a",
"sourceUrl": "https://fb.me/abc123"
},
"replyTo": {
"messageId": "msg_3Rt8vWq1",
"platformMessageId": "wamid.HBgNODgwMTcwMDAwMDAwMBUCABEYEjA"
},
"email": null,
"botEnabled": true,
"ticketId": null,
"inboxUrl": "https://<your-domain>/app/inbox/all/conv_abc123",
"at": "2026-10-07T09:14:02.981Z"
}
}Field Descriptions
Root Level
| Field | Type | Description |
|---|---|---|
event | string | Always "message.received" for this event |
timestamp | string (ISO 8601) | When this delivery was sent, not when the customer wrote |
data | object | The event body, described below |
Data Object
| Field | Type | Description |
|---|---|---|
eventId | string (UUID) | Stable ID for this event, derived from the message. It stays the same if a delivery is resent. Use it to deduplicate |
messageId | string | Our ID for the message. Pass it as replyToMessageId when you reply |
platformMessageId | string | null | The channel's own ID for the message (mid on Messenger and Instagram, wamid on WhatsApp, Message-ID on email). null on the website widget and mobile |
conversationId | string | The conversation. Pass it as conversationId when you reply |
platform | string | The channel. See Platforms |
channelId | string | Your Page, account, number, widget, app or mailbox ID. See Supported channels |
platformUserId | string | The customer's ID on that channel |
customerName | string | null | Display name, when the channel gave us one |
type | string | The kind of message. See Message Types |
text | string | null | The message text. On a file message, the caption or text the customer sent with the file. On email, the plain-text body (with quoted earlier messages removed). null when there is none |
attachments | array | Files sent with the message. Empty for a plain text message. See Attachment Object |
interaction | object | null | What the customer tapped to send this message: a quick reply, or a WhatsApp button or list row. null for a typed message. See Interaction Object |
referral | object | null | The ad or link this message came from. Set only on the message the customer sent from the ad or link, null otherwise. See Referral Object |
replyTo | object | null | The message the customer quoted or replied to, when the channel tells us. Both of its fields can be null if we do not have that message |
email | object | null | Email details. Set only when platform is EMAIL. See Email Object |
botEnabled | boolean | Whether the AI agent is on for this conversation when the message arrived. When true, the AI agent will answer this message |
ticketId | string | null | The open ticket for this conversation. null is normal, because a conversation need not have an open ticket |
inboxUrl | string | Deep link to the conversation in the inbox |
at | string (ISO 8601) | When the customer sent the message |
Attachment Object
| Field | Type | Description |
|---|---|---|
type | string | IMAGE, VIDEO, AUDIO, FILE or STICKER |
url | string | An https link to the file. How long it works depends on the channel. See Attachments by channel |
mimeType | string | null | e.g. image/jpeg. Set on email only |
fileName | string | null | The original file name. Set on email only |
size | number | null | Size in bytes. Set on email only |
Interaction Object
When the customer taps a quick reply or a button instead of typing, text holds the title they
saw and interaction tells you which one it was.
| Field | Type | Description |
|---|---|---|
type | string | quick_reply (Messenger, Instagram), button_reply (a WhatsApp reply button or a web chat button), list_reply (a WhatsApp list row), template_button (a quick-reply button on a WhatsApp template) |
id | string | null | The WhatsApp button or row id, or the web chat button's payload. null on Messenger and Instagram |
title | string | The text on the button |
payload | string | null | What the tap carries back: the quick-reply or template-button payload, or, for a WhatsApp reply button, list row or web chat button, its id. This is the payload you set when you sent the buttons with the Messaging API, so switch on this field whatever the channel |
Referral Object
Every field can be null. Messenger and Instagram fill source, type, ref and adId;
WhatsApp fills source, adId, adTitle, ctwaClid and sourceUrl.
| Field | Type | Description |
|---|---|---|
source | string | null | Messenger and Instagram: ADS, SHORTLINK (an m.me or ig.me link), CUSTOMER_CHAT_PLUGIN, … WhatsApp: ad or post |
type | string | null | OPEN_THREAD on Messenger and Instagram |
ref | string | null | The ref parameter of the link or ad |
adId | string | null | The ad's id, when the customer came from an ad |
adTitle | string | null | The ad's title or headline |
ctwaClid | string | null | WhatsApp only. The click id Meta's Conversions API needs to report a lead from a Click-to-WhatsApp ad |
sourceUrl | string | null | WhatsApp only. The ad or post URL |
Attachments by channel
platform | Several files in one customer message | Where url points | How long it works |
|---|---|---|---|
MESSENGER | One event per file, each with its own messageId and the same platformMessageId. Text sent with the files is in text on the first file's event | Meta's CDN | Meta's links expire, often within days. Copy the file if you need to keep it |
INSTAGRAM | As for Messenger: one event per file, each with its own messageId and the same platformMessageId, and the text on the first file's event | Meta's CDN | As for Messenger |
WHATSAPP | One event per file (WhatsApp sends each file as its own message). The caption is in text | Our media link | About 30 days, while WhatsApp keeps the file |
WEB, MOBILE | One file per message | Our storage | Permanent |
EMAIL | One event with every file | Our storage | Permanent. A file over 25 MB, or one we could not copy, is left out |
Email Object
| Field | Type | Description |
|---|---|---|
subject | string | The email subject |
from | string | The sender's address |
to | string[] | Recipient addresses |
cc | string[] | Copied addresses |
html | string | null | The HTML body, already cleaned of scripts. Still treat it as untrusted. data.text holds the plain-text body without quoted earlier messages |
Enum Values
Message Types
type | Meaning |
|---|---|
TEXT | Text only. attachments is empty |
IMAGE, VIDEO, AUDIO, FILE | A file. attachments holds it. On email, a message with files uses the first file's kind, and text holds the body |
STICKER | A sticker. The image is in attachments |
LINK | A shared link or a link preview card. The link is in text |
EMOJI | A single emoji or a like (👍) |
Platforms
MESSENGER, INSTAGRAM, WHATSAPP, WEB, MOBILE, EMAIL
Example Handler
app.post('/webhooks/messages', express.raw({ type: 'application/json' }), async (req, res) => {
if (!verifySignature(req.body, req.get('X-Webhook-Signature'))) {
return res.status(401).end();
}
res.status(200).end(); // answer within 30 seconds, then do the work
const { event, data } = JSON.parse(req.body.toString('utf8'));
if (event !== 'message.received') return;
if (await alreadyHandled(data.eventId)) return;
await helpdesk.addMessage({
threadId: data.conversationId,
channel: data.platform,
customer: { id: data.platformUserId, name: data.customerName },
body: data.text,
files: data.attachments.map((a) => a.url),
sentAt: data.at,
aiIsAnswering: data.botEnabled,
});
});Relation to message.created
message.created is an older event sent only for the Mobile Chat API.
It keeps working unchanged. message.received also covers mobile messages, so subscribe to
one or the other for mobile, not both, or you will get each mobile message twice.
Retries and Idempotency
A delivery that fails is retried automatically, up to 6 attempts in all: 1 minute, 5 minutes,
15 minutes, 1 hour and 6 hours after the previous failure. A delivery fails when your endpoint
can't be reached, times out, or answers 408, 429 or 5xx. Any other 4xx is treated as a
final answer and is not retried. Each retry carries an X-Webhook-Attempt header (2 for the
first retry). The signature covers the body only, not this header.
You can also resend a delivery by hand: open the webhook in Settings › Webhooks and go to its Logs tab.
Every retry and resend carries the same data.eventId and a new timestamp, so deduplicate on
data.eventId, never on timestamp.
Events can also arrive out of order when a customer sends several messages quickly. Sort on
data.at when order matters.
Verifying the Signature
Every delivery carries an X-Webhook-Signature header: the hex HMAC-SHA256 of the raw request
body. See webhook security for the full check, and the
AI Agent Control API for a worked example.
Next Steps
- Messaging API: reply to the message on the same channel
- Button Tapped Event: Get Started and button taps
- AI Agent Stopped Event: know when a person should take over
- AI Agent Control API: switch the AI off while your team replies