Incoming Messages on Webhook
When a user sends a message to Business, it's termed as Incoming Message for the business. Such messages are posted to to Webhook at real time with a JSON Payload of predefined format.
Type of Incoming Messages
Following type of messages are considered incoming messages:
- Text: Text messages are freeform responses.
- Suggestions: Suggestion messages are generated by user’s action on the message. Messages include the postback data and text of the suggested action or suggested reply that the user tapped.
- Location: Location messages include latitude and longitude values.
- File: File messages include the URI for a file and associated data.
Note
- All incoming messages from users follows a pre-defined Format.
- This page covers only "Text" and "File" type of respones.
- For "Location" and "Suggestions" type of messages, click here.
Standard JSON Format
{"agent": "{agent name}","phone": "{user phone}","request_id": "{request_id}","session_id": "{session id}","type": "{msg type}",// more object/keys will appear here// related to different type of content"timestamp": "{send time in UTC}",}
JSON Explanation
Key / Object | Data Type | Description |
---|---|---|
agent | String | Name of RBM Agent |
phone | String | Phone number of the person who sent the message to business |
request_id | String | Unique Request ID. Incoming Messages are identified by Request ID |
session_id | String | Session ID of follow-up conversation |
type | String | Enumerated values: text , suggestion , file , location |
timestamp | String | Time when its sent by Sender. In UTC. Format: YYYY-MM-DDTHH:II:SS.000Z |
Text Message
JSON Payload
{"agent": "{agent name}","phone": "{user phone}","request_id": "{request_id}","session_id": "{session id}","type": "text","text": "{Text Message}""timestamp": "{send time in UTC}",}
JSON Explanation: Covers only key/objects related to 'text` Content. For other keys, refer Standard JSON Format explained above.
Key / Object | Data Type | Description |
---|---|---|
type | String | It comes as text |
text | String | Plain text content |
Message with Rich Media File
JSON Payload
{"agent": "{agent name}","phone": "{user phone}","request_id": "{request_id}","session_id": "{session id}","type": "file","file": {"media": "image","$media": {"mimeType": "{mime type}","fileSizeBytes": {file size},"fileUri": "{https url of file}","fileName": "{file name}"}},"timestamp": "{send time in UTC}",}
JSON Explanation: Covers only key/objects related to 'text` Content. For other keys, refer Standard JSON Format explained above.
Key / Object | Data Type | Description |
---|---|---|
type | String | It comes as file |
file | Object | Contains main media file information |
file.media | String | Type of media file. Enumerated values: image , video , document |
file.$media | Object | $media is named after value of file.media . For Example, if file.media:video , then $media object be named as video |
JSON Explanation: Covers only media information in $media
object, viz.
Key / Object | Data Type | Description |
---|---|---|
mimeType | String | Mime type of image, e.g. image/jpeg |
fileSizeBytes | Numbeer | File Size (In byte) |
fileUri | String | Access URL for the file |
fileName | String | Name of the file |