Discover detailed information about our services. Get Brochure Now

Webhook

​

Incoming Messages

When a user sends a message to Business, it’s termed as Incoming Message for the business.
Such messages are posted to Webhook at real time with a JSON Payload of predefined format.

Note: Both user-originated message or responses to business-originated
messages are received through Webhook.

Standard JSON Format

Whether its user-initiated message or follow-up message from a user, incoming messages with
different type of content will have common JSON format as given below:

{
  "messageId": "{message id}",
  "channel": "whatsapp",
  "from": "{sender phone}",
  "to": "{receiver phone}",
  "receivedAt": "{ISO timestamp}",
  "content": {
    "contentType": "text",
    "text": "X2"
  },
  "whatsapp": {
    "senderName": "{sender name}"
  },
  "context": {
    "messageId": "{message id}"
  },
  "timestamp": "{ISO timestamp}",
  "event": "MoMessage",
  "isin24window": true,
  "isResponded": false,
  "UserResponse": "X2"
}

JSON Explanation

Key / Object Data Type Description
messageId String Unique ID of the message.
channel String Messaging platform (e.g. whatsapp).
from String Sender phone number including country code.
to String Business phone number receiving the message.
content Object Contains message type and actual message data.
whatsapp Object Platform specific metadata.
timestamp String ISO timestamp when event occurred.
event String Event type (e.g. MoMessage).
isin24window Boolean Indicates if message is inside 24-hour session
window.
isResponded Boolean Indicates if business responded to the message.

Type of Incoming Messages

Read the following section to understand different types of incoming messages
and related JSON received on Webhook.

Text Message

JSON Payload

{
  "messageId": "{message id}",
  "channel": "whatsapp",
  "from": "{sender phone}",
  "to": "{receiver phone}",
  "receivedAt": "{ISO timestamp}",
  "content": {
    "contentType": "text",
    "text": "{text content}"
  },
  "whatsapp": {
    "senderName": "{sender name}"
  },
  "context": {
    "messageId": "{message id}"
  },
  "timestamp": "{ISO timestamp}",
  "event": "MoMessage",
  "isin24window": true,
  "isResponded": false,
  "UserResponse": "{text content}"
}

JSON Explanation (Text Message)

Key / Object Data Type Description
content.contentType String Defines message type. For text messages it will
be “text”.
content.text String Actual text message sent by the user.
UserResponse String Represents the user’s response content.

Message with Image

JSON Payload

{
  "messageId": "{message id}",
  "channel": "whatsapp",
  "from": "{sender phone}",
  "to": "{receiver phone}",
  "receivedAt": "{ISO timestamp}",
  "content": {
    "contentType": "media",
    "media": {
      "type": "image",
      "url": "{media url}"
    }
  },
  "whatsapp": {
    "senderName": "{sender name}"
  },
  "timestamp": "{ISO timestamp}",
  "event": "MoMessage",
  "isin24window": true,
  "isResponded": false
}

JSON Explanation (Image Message)

Key / Object Data Type Description
content.contentType String For media messages this will be
“media”.
content.media Object Contains media-related information.
content.media.type String Specifies media type. For this case it will be
“image”.
content.media.url String Public or internal URL where the uploaded image is
stored.

Message with Video

JSON Payload

{
  "messageId": "{message id}",
  "channel": "whatsapp",
  "from": "{sender phone}",
  "to": "{receiver phone}",
  "receivedAt": "{ISO timestamp}",
  "content": {
    "contentType": "media",
    "media": {
      "type": "video",
      "url": "{video url}"
    }
  },
  "whatsapp": {
    "senderName": "{sender name}"
  },
  "timestamp": "{ISO timestamp}",
  "event": "MoMessage",
  "isin24window": true,
  "isResponded": false
}

JSON Explanation (Video Message)

Key / Object Data Type Description
content.contentType String For media messages this will be
“media”.
content.media Object Contains media-related information.
content.media.type String Specifies media type. For this case it will be
“video”.
content.media.url String URL where the uploaded video file is stored.

Message with Audio

JSON Payload

{
  "messageId": "{message id}",
  "channel": "whatsapp",
  "from": "{sender phone}",
  "to": "{receiver phone}",
  "receivedAt": "{ISO timestamp}",
  "content": {
    "contentType": "media",
    "media": {
      "type": "audio",
      "url": "{audio url}"
    }
  },
  "whatsapp": {
    "senderName": "{sender name}"
  },
  "timestamp": "{ISO timestamp}",
  "event": "MoMessage",
  "isin24window": true,
  "isResponded": false
}

JSON Explanation (Audio Message)

Key / Object Data Type Description
content.contentType String For media messages this will be
“media”.
content.media.type String Specifies media type. For this case it will be
“audio”.
content.media.url String URL where the uploaded audio file is stored (e.g.
.mp3).

Message with Voice

JSON Payload

{
  "messageId": "{message id}",
  "channel": "whatsapp",
  "from": "{sender phone}",
  "to": "{receiver phone}",
  "receivedAt": "{ISO timestamp}",
  "content": {
    "contentType": "media",
    "media": {
      "type": "voice",
      "url": "{voice url}"
    }
  },
  "whatsapp": {
    "senderName": "{sender name}"
  },
  "timestamp": "{ISO timestamp}",
  "event": "MoMessage",
  "isin24window": true,
  "isResponded": false
}

JSON Explanation (Voice Message)

Key / Object Data Type Description
content.contentType String For media messages this will be
“media”.
content.media.type String Specifies media type. For this case it will be
“voice”.
content.media.url String URL where the recorded voice note file is stored
(typically .ogg).

Message with Document

JSON Payload

{
  "messageId": "{message id}",
  "channel": "whatsapp",
  "from": "{sender phone}",
  "to": "{receiver phone}",
  "receivedAt": "{ISO timestamp}",
  "content": {
    "contentType": "media",
    "media": {
      "type": "document",
      "filename": "{file name with extension}",
      "url": "{document url}"
    }
  },
  "whatsapp": {
    "senderName": "{sender name}"
  },
  "timestamp": "{ISO timestamp}",
  "event": "MoMessage",
  "isin24window": true,
  "isResponded": false
}

JSON Explanation (Document Message)

Key / Object Data Type Description
content.contentType String For media messages this will be “media”.
content.media.type String Specifies media type. For this case it will be “document”.
content.media.filename String Name of the uploaded document including file extension.
content.media.url String URL where the uploaded document file is stored.

Message with Emoji

JSON Payload

{
  "messageId": "{message id}",
  "channel": "whatsapp",
  "from": "{sender phone}",
  "to": "{receiver phone}",
  "receivedAt": "{ISO timestamp}",
  "content": {
    "contentType": "text",
    "text": "πŸ˜€"
  },
  "whatsapp": {
    "senderName": "{sender name}"
  },
  "timestamp": "{ISO timestamp}",
  "event": "MoMessage",
  "isin24window": true,
  "isResponded": false,
  "UserResponse": "πŸ˜€"
}

JSON Explanation (Emoji Message)

Key / Object Data Type Description
content.contentType String For emoji messages this will be “text”.
content.text String Contains the emoji character. Emojis are standard Unicode text characters.
UserResponse String Stores the emoji sent by the user.

Message with Template

JSON Payload

{
  "messageId": "{message id}",
  "channel": "whatsapp",
  "from": "{sender phone}",
  "to": "{receiver phone}",
  "whatsapp": {
    "text": "{button label}",
    "senderName": "{sender name}"
  },
  "context": {
    "messageId": "{parent message id}"
  },
  "postback": {
    "data": "{postback payload id}"
  },
  "timestamp": "{unix timestamp}",
  "event": "MoMessage::Postback",
  "content": {
    "contentType": "text",
    "text": "{button label}"
  },
  "isin24window": true,
  "isResponded": false,
  "TemplateName": "{template name}",
  "UserResponse": "{button label}"
}

JSON Explanation (Template)

Key / Object Data Type Description
event String For template button clicks this will be “MoMessage::Postback”.
postback.data String Unique identifier associated with the template button.
TemplateName String Name of the WhatsApp template that generated the button.
whatsapp.text String Label of the button clicked by the user.
content.contentType String Will still be “text” because button click returns text.
content.text String Contains the button label selected by the user.
context.messageId String Refers to the original template message ID.

Interactive Message

JSON Payload

{
  "messageId": "{message id}",
  "channel": "whatsapp",
  "from": "{sender phone}",
  "to": "{receiver phone}",
  "whatsapp": {
    "title": "{selected option title}",
    "senderName": "{sender name}"
  },
  "context": {
    "messageId": "{parent message id}"
  },
  "postback": {
    "data": "{postback payload id}"
  },
  "timestamp": "{unix timestamp}",
  "event": "MoMessage::Postback",
  "content": {
    "contentType": "text"
  },
  "isin24window": true,
  "isResponded": false,
  "InteractiveMessageTitle": "{interactive template name}"
}

JSON Explanation (Interactive)

Key / Object Data Type Description
event String Will be “MoMessage::Postback” for interactive selections.
whatsapp.title String Title of the interactive option selected by the user.
postback.data String Unique identifier of the selected interactive option.
InteractiveMessageTitle String Name of the interactive message configuration.
context.messageId String Refers to the original interactive message sent by the business.

Message Status Events

These events represent delivery lifecycle updates for outbound messages sent by the business.

{
  "messageId": "{message id}",
  "status": "accepted",
  "timestamp": "{ISO timestamp}"
}

{
  "messageId": "{message id}",
  "status": "delivered",
  "timestamp": "{ISO timestamp}"
}

{
  "messageId": "{message id}",
  "status": "seen",
  "timestamp": "{ISO timestamp}"
}
{
  "messageId": "{message id}",
  "status": "failed",
  "timestamp": "{ISO timestamp}"
}

JSON Explanation (Message Status)

Key / Object Data Type Description
messageId String Unique identifier of the outbound message whose status is being updated.
status String Indicates delivery state. Possible values:
“accepted”,
“delivered”,
“seen”,
“failed”.
timestamp String (ISO) Time at which the status update occurred.

 

 

whatsapp-icon