Message Object
Name | Type | Description |
---|---|---|
room | STRING | Chat unique identifier |
data | object | Object containing message info. See message data object for more details. |
Message Data Object
Name | Type | Description |
---|---|---|
id | string | message unique identifier |
messageType | STRING | Type of the message. Can assume one of the following values: “TEXT” “IMAGE” “DOCUMENT” “LINK” “AUDIO” “VIDEO” “MENU” “MENU_RESPONSE” “QUICK_REPLY” “QUICK_REPLY_RESPONSE” “FORM” “FORM_RESPONSE” “REACTION” “CONTACTS” “LOCATION” “videoRequestedByAgent” “videoRequestedByCustomer” “videoAccepted” “videoRejected” “videoStarted” “videoEnded” “screenSharingStarted” “screenSharingEnded” “endChat” “leave” |
ts | NUMBER | Timestamp of when message was sent |
deliverySuccess | boolean | Indicates if the message has been succesfully delivered |
deliveryErrorReason | string | In case of delivery failed, describes the error occurred |
messageSeen | number / null | Timestamp of when the message was seen by the recipient |
replyTo | string | Message ID you are replying to |
content | object | Message content. See message content object for more details. |
Message Content Object
The structure of the message content depends on the messageType property
Text message
Name | Type | Description |
---|---|---|
text | STRING | Only in “TEXT” message, contains the message sent |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
{
"data" : {
"replyTo" : "",
"id" : "e857df30-76a4-4c6c-b4a5-4faed2ed6f45",
"messageType" : "TEXT",
"content" : {
"text" : "Buongiorno, sono l'operatore Gabriele Verde, come posso esserle utile?",
"user" : {
"id" : "USER_gverde1@acd.enghouse.com",
"isAgent" : true
}
},
"ts" : 1643191581119.0,
"deliverySuccess" : true,
"deliveryErrorReason" : "",
"messageSeen" : null
},
"_id" : ObjectId("61f11d7cd42454470cb22da4"),
"room" : "CHAT_DEFAULT_a098a0bc-b34c-452c-829c-1b03aa7a67ee"
}
Image message
Name | Type | Description |
---|---|---|
caption | STRING | Message caption |
fileName | string | Contains name of the document/image message |
documentType | string | Document format |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
{
"data" : {
"replyTo" : "",
"id" : "03250778-0425-47c1-92c1-85d1840bef7c",
"messageType" : "IMAGE",
"content" : {
"caption" : "",
"fileName" : "45971097-illustrazione-di-happy-emoticon-dà-pollice-in-su-isolato-su-sfondo-bianco.jpg",
"documentType" : "jpg",
"user" : {
"id" : "USER_DEFAULT_9a0a411c-f9c7-4af7-9754-024bf157a3ef",
"isAgent" : false
}
},
"ts" : 1643191627987.0,
"deliverySuccess" : true,
"deliveryErrorReason" : "",
"messageSeen" : null
},
"_id" : ObjectId("61f11d7cd42454470cb22da5"),
"room" : "CHAT_DEFAULT_a098a0bc-b34c-452c-829c-1b03aa7a67ee"
}
Document message:
Name | Type | Description |
---|---|---|
caption | STRING | Message caption |
fileName | string | Contains name of the document/image message |
documentType | string | Document format |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
{
"data" : {
"replyTo" : "",
"id" : "16daf4d4-a77f-406f-ab75-0475f510bc95",
"messageType" : "DOCUMENT",
"content" : {
"caption" : "",
"fileName" : "WHATSAPP-TEMPLATE-AD-v09.xlsx",
"documentType" : "xlsx",
"user" : {
"id" : "USER_gverde1@acd.enghouse.com",
"isAgent" : true
}
},
"ts" : 1643191652417.0,
"deliverySuccess" : true,
"deliveryErrorReason" : "",
"messageSeen" : null
},
"_id" : ObjectId("61f11d7cd42454470cb22da6"),
"room" : "CHAT_DEFAULT_a098a0bc-b34c-452c-829c-1b03aa7a67ee"
}
Video message:
Name | Type | Description |
---|---|---|
caption | STRING | Message caption |
fileName | string | Contains name of the document/image message |
documentType | string | Document format |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
Audio message:
caption | STRING | Message caption |
fileName | string | Contains name of the document/image message |
documentType | string | Document format |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
Link message:
Name | Type | Description |
---|---|---|
url | string | Contains the url of the link message |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
Menu message (bot):
Name | Type | Description |
---|---|---|
text | string | Menu title |
options | array | Array of objects for the various possibilities of choice. See the next section for more details. |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
option object:
Name | Type | Description |
---|---|---|
id | number | Unique option id |
command | string | Menu action. Can assume one of the following values:
|
text | string | label shown in the option |
targetUrl | string | text to send as a next query to the bot |
params | array | array of two objects that specify how to open the external url. The first object has two properties:
The second object has two properties:
|
Example
Menu response message (bot):
Name | Type | Description |
---|---|---|
menuId | string | Id of the “MENU” message which was replied to |
option | object | Response that was chosen by the user. See the next section for more details |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
option object:
Name | Type | Description |
---|---|---|
id | string | Id of the response chosen |
targetUrl | string | query sent to the bot |
Example
Quick reply message (bot):
Name | Type | Description |
---|---|---|
text | string | Title of the quick reply |
header | string | header of the quick reply |
footer | string | footer of the quick reply |
quickReplies | array | array of strings containing the options (max 3 allowed) |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
Quick reply response message (bot):
Name | Type | Description |
---|---|---|
quickReplyId | string | id of the quick reply message whose response is referring to |
reply | string | quick reply chosen |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
Form message (bot):
Name | Type | Description |
---|---|---|
title | string | title fo the form |
response_to_bot | string | query sent back to the bot after the form is submitted |
formData | array | array of objects that defines the form fields. The object has the same properties of the data collection object Data Collection Object |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
Form response message (bot):
The form response message has the same structure of the form message, with the addition that the field “value” is filled with the customer response.
Example
Reaction message:
Name | Type | Description |
---|---|---|
emoji | string | emoji sent |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
Contacts message:
Name | Type | Description |
---|---|---|
contacts | array | array of objects representing the contact. See the table below for the properties of the contact object. |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
option object:
Name | Type | Description |
---|---|---|
name | object | object containing the name of the contact. See table below for details. |
phones | array | Array of objects containing the phone numbers of the contact. See table below |
name object:
Name | Type | Description |
---|---|---|
first_name | string | contact name |
formatted_name | string | contact formatted name |
phone object:
Name | Type | Description |
---|---|---|
phone | string | phone number |
wa_id | string | whatsapp id |
type | string | phone type |
Example
Location message:
Name | Type | Description |
---|---|---|
latitude | number | latitude coordinate |
longitude | number | longitude coordinate |
name | string | location name |
url | string | location public url |
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
Video chat events messages:
All video chat events messages have the audio and video boolean properties to indicate the channel used.
Name | Type | Description |
---|---|---|
audio | boolean | if true the audio chennel is engaged |
video | BOOLEAN | if true the video chennel is engaged |
Examples
videoRequestedByCustomer message
videoAccepted message:
videoStarted message:
screenSharingStarted message:
videoEnded message:
endChat message:
Name | Type | Description |
---|---|---|
user | object | Semplified user object containing only user id and isAgent properties of the user who sent the message. |