Skip to main content

Incoming Messages

Webhook 

With every incoming message, you will receive the following webhook (hook "new").

Settings:

SettingValue
URLYour URL — set it with Set Webhook
MethodJSON 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"
}
}
warning

You must download the link files to your server. We delete all files within 7 days.

Response explained​

ParameterDescription / Example
status"OK" always.
hook"new" always, for a new incoming message.
uniqueUnique ID for the incoming message. Use it as replyTo to quote the message in your reply, or to react to it with Send Reaction.
fromThe 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_idThe 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.
usernameThe username the client chose for their WhatsApp. This feature is not available yet and will return null until officially released by Meta.
countryThe country code (two letters) of the contact person (sender), taken from their user id. Null when there is no user id.
phoneThe 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.
toYour WhatsApp account.
senderNameThe name of the person that sent the message. For type phone, the name they shared.
typeMessage 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.
bodyThe content of the 'body' depends on the 'type' of the message — see "body by message type" below.
captionThe content of the 'caption' depends on the 'type' of the message — see "caption by message type" below.
templateThe 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.
isForwardedShows if the incoming message is forwarded — true or false.
timestampTime stamp of the incoming message (Unix time, in seconds, as a string).
timestampMSThe sub-second part of the timestamp (the digits after the decimal point of the time we processed the message), in case you need it.
mediaIf this message contains any media file, it will be true; otherwise false.
quoteIf 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.
quoteUniqueIn 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.
profilePicjpg 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.
conversationTimeLeftAmount 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.
isNewConversationWhether 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.
referralObject of items that describes the original referral that initiated the incoming WhatsApp message — see "referral" below.
orderOnly 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​

TypeThe data that will come
textRegular incoming message
imageA link to download the image file (jpg)
audioA link to download the audio file (ogg)
videoA link to download the video file (mp4)
locationA location text in format latitude,longitude
pttA link to download the push to talk audio (voice message, ogg)
documentA link to download the document file
buttonThe text of the button that was selected
contactsThe phone number that was shared
listThe selection text from the list
reactionThe emoji that was sent — empty when the client removed their reaction
orderThe note the client wrote with the order — the items are in order
phoneThe 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​

TypeThe data that will come
textNothing, empty
imageCaption text with the image
audioNothing, empty
videoCaption text with the video
locationThe name and address of the place (name - address), when the client shared a place; otherwise empty
pttNothing, empty
documentCaption text with the document
buttonThe 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)
contactsThe name of the contact
listThe item list ID that was selected (Send List)
reactionNothing, empty
orderThe store (catalog) ID number
phoneThe 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:

FieldDescription
ref_typenone (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:

FieldDescription
ref_titleThe title of the post / ad.
ref_bodyThe message of the post / ad.
ref_idID of the post / ad.
ref_linkLink to the post / ad.
ref_imageImage 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"
}
]
FieldDescription
product_retailer_idThe product ID of the item.
quantityThe quantity of that product.
item_priceThe price of each product.
currencyThe currency of that product.

Remarks​

  • Stickers and other message kinds that are not listed in type are not forwarded.
  • In the text of text, button and list messages, in senderName and 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​

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.