Incoming Messages
Webhook
With every incoming message, you will receive the following webhook
(hook "new").
Settings:
| Setting | Value |
|---|---|
| URL | Your URL — set it with Set Webhook |
| Method | JSON via POST |
Incoming messages webhooks are always sent once a webhook URL is set. How webhooks are delivered and retried, and the IP address they come from, is explained on Webhook.
{
"status": "OK",
"hook": "new",
"unique": "92E004B950CCEA3C386FCFA2AAF8558A",
"from": "972501234567",
"from_id": "IL.1605856887361213",
"username": null,
"country": "IL",
"phone": "972501234567",
"to": "972771234567",
"senderName": "Dana Cohen",
"type": "text",
"body": "Hi, is the store open today?",
"caption": "",
"template": null,
"isForwarded": false,
"timestamp": "1789900000",
"timestampMS": 483921,
"media": false,
"quote": false,
"quoteUnique": false,
"profilePic": "https://storage.99digital.online/profilePic/1789900000-ab12cd34.jpg",
"conversationTimeLeft": 1435,
"isNewConversation": 1,
"referral": {
"ref_type": "none"
}
}
You must download the link files to your server. We delete all files within 7 days.
Response explained
| Parameter | Description / Example |
|---|---|
status | "OK" always. |
hook | "new" always, for a new incoming message. |
unique | Unique ID for the incoming message. Use it as replyTo to quote the message in your reply, or to react to it with Send Reaction. |
from | The contact person that sent you the message, in international format: 972501234567. If the person is hiding their identity (enabled the username feature), this value will return the from_id, for example IL.1605856887361213. |
from_id | The contact person (sender) user id. It arrives whenever WhatsApp provides it, also when the client did not hide their identity; otherwise null. The format is always 2 letters country code + dot + 16 digits, for example IL.1605856887361213. This value is fixed per end user per WhatsApp API account. You can use this value to send messages to the client. |
username | The username the client chose for their WhatsApp. This feature is not available yet and will return null until officially released by Meta. |
country | The country code (two letters) of the contact person (sender), taken from their user id. Null when there is no user id. |
phone | The contact person phone number, in international format, for example 972501234567. If the phone number is not available (the client hides their identity), this will return null. |
to | Your WhatsApp account. |
senderName | The name of the person that sent the message. For type phone, the name they shared. |
type | Message type. Can be one of the following: text, image, audio, video, location, ptt, document, button, contacts, list, reaction, order, phone. What arrives in body and caption for each type is in the tables below. |
body | The content of the 'body' depends on the 'type' of the message — see "body by message type" below. |
caption | The content of the 'caption' depends on the 'type' of the message — see "caption by message type" below. |
template | The template name, if the client clicked on a quick reply button when getting the template (Send a Template). For everything else, this will return null. |
isForwarded | Shows if the incoming message is forwarded — true or false. |
timestamp | Time stamp of the incoming message (Unix time, in seconds, as a string). |
timestampMS | The sub-second part of the timestamp (the digits after the decimal point of the time we processed the message), in case you need it. |
media | If this message contains any media file, it will be true; otherwise false. |
quote | If this message is a quoted message, it will be true; otherwise false. A reaction is always quoted: it points to the message the client reacted to. |
quoteUnique | In case the message is quoted (it means that someone replied to your outgoing message), this will be the original message unique ID — for your own message, the unique you received when you sent it. For a reaction, the message the client reacted to. If the message is not quoted, this will be false. |
profilePic | jpg file link to the client's profile picture, if the user has a profile picture and their privacy settings allow it; otherwise a link to a default image. Profile picture links are generated once per number. |
conversationTimeLeft | Amount of minutes left for the incoming conversation session to end (up to 1435). If passed, any incoming message after that will be considered as a new incoming conversation, and the timer will reset. |
isNewConversation | Whether this message started a new incoming message conversation session or not. 0 — this new message does not open a new conversation. 1 — this new message opens a new conversation. |
referral | Object of items that describes the original referral that initiated the incoming WhatsApp message — see "referral" below. |
order | Only for type order: the list of products of the order summary that was sent from your WhatsApp store — see "order" below. |
body by message type
| Type | The data that will come |
|---|---|
| text | Regular incoming message |
| image | A link to download the image file (jpg) |
| audio | A link to download the audio file (ogg) |
| video | A link to download the video file (mp4) |
| location | A location text in format latitude,longitude |
| ptt | A link to download the push to talk audio (voice message, ogg) |
| document | A link to download the document file |
| button | The text of the button that was selected |
| contacts | The phone number that was shared |
| list | The selection text from the list |
| reaction | The emoji that was sent — empty when the client removed their reaction |
| order | The note the client wrote with the order — the items are in order |
| phone | The phone number that was shared when the client revealed their phone number (Request Phone) |
You must download the link files to your server: we delete all files within
7 days. Documents are kept as pdf, zip, xls, xlsx, doc, docx, csv, apk, rar,
ppt, pptx or wav; a jpg, png or mp4 sent as a document arrives as image or
video. If a file could not be kept (for example a document of another file
type), body is empty and media is false.
caption by message type
| Type | The data that will come |
|---|---|
| text | Nothing, empty |
| image | Caption text with the image |
| audio | Nothing, empty |
| video | Caption text with the video |
| location | The name and address of the place (name - address), when the client shared a place; otherwise empty |
| ptt | Nothing, empty |
| document | Caption text with the document |
| button | The ID of the button that was selected. This ID arrives for the Send Buttons and Send Carousel button IDs, and for a template quick reply button (if you provided a quickReply button id) |
| contacts | The name of the contact |
| list | The item list ID that was selected (Send List) |
| reaction | Nothing, empty |
| order | The store (catalog) ID number |
| phone | The name of the person that revealed their phone number |
The answer to Request Location arrives as
type location.
referral
Object of items that describes the original referral that initiated the incoming WhatsApp message. Available data:
| Field | Description |
|---|---|
ref_type | none (for a non-referral incoming message), post (Facebook / Instagram post) or ad (Facebook / Instagram campaign). |
If the ref_type is post or ad, more information will be available:
| Field | Description |
|---|---|
ref_title | The title of the post / ad. |
ref_body | The message of the post / ad. |
ref_id | ID of the post / ad. |
ref_link | Link to the post / ad. |
ref_image | Image of the original post / ad (the link will be deleted in 7 days). Null when there is no image. |
"referral": {
"ref_type": "ad",
"ref_title": "Summer sale",
"ref_body": "20% off everything",
"ref_id": "120210000000000000",
"ref_link": "https://fb.me/xyz123",
"ref_image": "https://storage.99digital.online/files/1789900000Qw3Er4Ty5U.jpg"
}
order
This is the list of products of the order summary that was sent from your WhatsApp store. This parameter is an array of items, and looks like this:
"order": [
{
"product_retailer_id": "woo_92",
"quantity": 2,
"item_price": 24,
"currency": "ILS"
},
{
"product_retailer_id": "woo_70",
"quantity": 3,
"item_price": 10,
"currency": "ILS"
}
]
| Field | Description |
|---|---|
product_retailer_id | The product ID of the item. |
quantity | The quantity of that product. |
item_price | The price of each product. |
currency | The currency of that product. |
Remarks
- Stickers and other message kinds that are not listed in
typeare not forwarded. - In the text of
text,buttonandlistmessages, insenderNameand in contact names, a single quote (') arrives as a backtick (`). - An example of every message type is under Webhook payload below.
Webhook payload
Your response
- 200
- default
Received. Answer with any 2xx status (200, 201, 204 …) — we wait up to 5 seconds to connect and up to 15 seconds for your answer. The body of your answer is ignored.
Any other status, or no answer in time, counts as a failed delivery. With retry 1 in Set Webhook we try again: immediately, then after 5 minutes, 20 minutes, 1 hour, 4 hours and 24 hours. Without it, the webhook is not sent again.