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 |
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" : "" }, "_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" : "" }, "_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" : "" }, "_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
{ "data" : { "replyTo" : "", "id" : "m_dXya7ckVUHyYxQHcQrrdgT2MVSImQFjQ7aCDxA_Mxf7AeR9GMI0vDs2dy2PKgTjE24tQrJImLWYnR5hgtpt7Uw", "messageType" : "VIDEO", "content" : { "caption" : "", "fileName" : "video.mp4", "documentType" : "mp4", "user" : { "id" : "4149729381806003", "isAgent" : false } }, "ts" : 1643207226322.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "_id" : ObjectId("61f15a4c932c660c83d5e229"), "room" : "CHAT_DEFAULT_06b6ace1-a923-4657-876b-c6432729610d" }
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
{ "data" : { "replyTo" : "", "id" : "m_JLR7O2EHIE6d3fiskFBiqz2MVSImQFjQ7aCDxA_Mxf6hm6TYUaJKXiEqfYgCX8WKxriZux06OzPB8XLZa8yNKA", "messageType" : "AUDIO", "content" : { "caption" : "", "fileName" : "audioclip-1643206881000-5760.mp4", "documentType" : "mp4", "user" : { "id" : "4149729381806003", "isAgent" : false } }, "ts" : 1643206886118.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "_id" : ObjectId("61f158ee932c660c83d5e1fa"), "room" : "CHAT_DEFAULT_24ec70f1-b92d-44c4-94ad-49bcd15986ea" }
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
{ "data" : { "replyTo" : "", "id" : "17909c52-1f26-402c-90cb-3106ba80bb3b", "messageType" : "LINK", "content" : { "url" : "https://www.google.it", "user" : { "id" : "USER_gverde1@acd.enghouse.com", "isAgent" : true } }, "ts" : 1643191666618.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "_id" : ObjectId("61f11d7cd42454470cb22da7"), "room" : "CHAT_DEFAULT_a098a0bc-b34c-452c-829c-1b03aa7a67ee" }
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
{ "data" : { "replyTo" : "", "id" : "d77210fa-4aa2-4876-8fcc-8eaf43122987", "messageType" : "MENU", "content" : { "text" : "Scegli un'opzione:", "options" : [ { "id" : 0, "command" : "load-item", "text" : "prenotazione volo", "targetUrl" : "vorrei prenotare un volo" }, { "id" : 1, "command" : "open-url", "params" : [ { "name" : "method", "text" : "GET" }, { "name" : "where", "text" : "_blank" } ], "text" : "google", "targetUrl" : "https://www.google.it" }, { "id" : 2, "command" : "open-url", "params" : [ { "name" : "method", "text" : "GET" }, { "name" : "where", "text" : "_blank" } ], "text" : "enghouse", "targetUrl" : "https://enghouseinteractive.it/" } ], "user" : { "id" : "BOT_BOT1", "isAgent" : true } }, "ts" : 1655210172935.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "_id" : ObjectId("62a880c20ece623848eb290a"), "room" : "CHAT_DEFAULT_84afbdd3-a4be-4057-ae49-32edc6802658" }
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
{ "data" : { "replyTo" : "", "id" : "fdaa821a-4355-4f3a-9507-1184c3285701", "messageType" : "MENU_RESPONSE", "content" : { "menuId" : "d77210fa-4aa2-4876-8fcc-8eaf43122987", "option" : { "id" : 0, "targetUrl" : "vorrei prenotare un volo" }, "user" : { "id" : "USER_DEFAULT_9a0a411c-f9c7-4af7-9754-024bf157a3ef", "isAgent" : false } }, "ts" : 1655210175559.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "_id" : ObjectId("62a880c20ece623848eb290b"), "room" : "CHAT_DEFAULT_84afbdd3-a4be-4057-ae49-32edc6802658" }
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
{ "data" : { "replyTo" : "", "id" : "5bd5fcd0-ee5e-48c9-b825-c3e42b85cc45", "messageType" : "QUICK_REPLY", "content" : { "text" : "Do you want to continue?", "quickReplies" : [ "No", "Yes", "Help" ], "header" : "Cool Title!", "footer" : "Cool Footer!", "user" : { "id" : "BOT_BOT1", "isAgent" : true } }, "ts" : 1679325011759.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "room" : "CHAT_DEFAULT_e7473a4a-88c7-415d-957b-01aac31673c0" }
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
{ "data" : { "replyTo" : "", "id" : "wamid.HBgMMzkzNDAzNjA5MTY5FQIAEhggMUM2MjFFNDYxMjIwRTYyQkNGRUVEMEVGMDE5RUVEQTcA", "messageType" : "QUICK_REPLY_RESPONSE", "content" : { "quickReplyId" : "5bd5fcd0-ee5e-48c9-b825-c3e42b85cc45", "reply" : "Yes", "user" : { "id" : "393403602702", "isAgent" : false } }, "ts" : 1679325017885.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "room" : "CHAT_DEFAULT_e7473a4a-88c7-415d-957b-01aac31673c0" }
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
{ "data" : { "replyTo" : "", "id" : "f3f3352c-7f50-43c6-9dd8-7db3fa44ce8c", "messageType" : "FORM", "content" : { "title" : "Titolo Form", "response_to_bot" : "ciao", "formData" : [ { "value" : "", "label" : "Società", "customMandatoryErrorMessage" : "Campo obbligatorio", "isMandatory" : true, "custom_regexp" : "", "customValidationErrorMessage" : "", "mode" : "manual", "isEditable" : true, "isVisibleCustomer" : true, "isVisibleAgent" : true, "name" : "company", "dc_type" : "text" }, { "label" : "Indirizzo", "custom_regexp" : "", "name" : "address", "isEditable" : true, "customMandatoryErrorMessage" : "Indirizzo obbligatorio", "isVisibleCustomer" : true, "isVisibleAgent" : true, "mode" : "manual", "value" : "", "dc_type" : "text", "isMandatory" : true, "customValidationErrorMessage" : "" }, { "value" : "", "dc_type" : "email", "isVisibleCustomer" : true, "mode" : "manual", "isMandatory" : true, "isVisibleAgent" : true, "customMandatoryErrorMessage" : "Email obbligatoria", "custom_regexp" : ".*@.*", "customValidationErrorMessage" : "Email non valida", "label" : "Email", "name" : "email2", "isEditable" : true }, { "options" : { "mattina" : "Mattina", "pomeriggio" : "Pomeriggio" }, "name" : "fascia", "isMandatory" : true, "dc_type" : "select", "value" : "", "isVisibleCustomer" : true, "customValidationErrorMessage" : "", "isEditable" : true, "mode" : "manual", "customMandatoryErrorMessage" : "Fascia richiamo obbligatoria", "isVisibleAgent" : true, "custom_regexp" : "", "label" : "Quando vuoi essere richiamato?" } ], "user" : { "id" : "BOT_BOT1", "isAgent" : true } }, "ts" : 1679325464928.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "room" : "CHAT_DEFAULT_df3b98ab-4a53-4d1f-8138-c3b45a58c9a0" }
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
{ "data" : { "replyTo" : "", "id" : "1601da67-ccf3-495e-b86b-3c51bae8789d", "messageType" : "FORM_RESPONSE", "content" : { "title" : "Titolo Form", "response_to_bot" : "ciao", "formData" : [ { "value" : "Enghouse", "label" : "Società", "customMandatoryErrorMessage" : "Campo obbligatorio", "isMandatory" : true, "custom_regexp" : "", "customValidationErrorMessage" : "", "mode" : "manual", "isEditable" : true, "isVisibleCustomer" : true, "isVisibleAgent" : true, "name" : "company", "dc_type" : "text" }, { "label" : "Indirizzo", "custom_regexp" : "", "name" : "address", "isEditable" : true, "customMandatoryErrorMessage" : "Indirizzo obbligatorio", "isVisibleCustomer" : true, "isVisibleAgent" : true, "mode" : "manual", "value" : "Viale Sarca 336, edificio 12", "dc_type" : "text", "isMandatory" : true, "customValidationErrorMessage" : "" }, { "value" : "legal.operations@enghouse.com", "dc_type" : "email", "isVisibleCustomer" : true, "mode" : "manual", "isMandatory" : true, "isVisibleAgent" : true, "customMandatoryErrorMessage" : "Email obbligatoria", "custom_regexp" : ".*@.*", "customValidationErrorMessage" : "Email non valida", "label" : "Email", "name" : "email2", "isEditable" : true }, { "options" : { "mattina" : "Mattina", "pomeriggio" : "Pomeriggio" }, "name" : "fascia", "isMandatory" : true, "dc_type" : "select", "value" : "mattina", "isVisibleCustomer" : true, "customValidationErrorMessage" : "", "isEditable" : true, "mode" : "manual", "customMandatoryErrorMessage" : "Fascia richiamo obbligatoria", "isVisibleAgent" : true, "custom_regexp" : "", "label" : "Quando vuoi essere richiamato?" } ], "user" : { "id" : "USER_DEFAULT_9a0a411c-f9c7-4af7-9754-024bf157a3ef", "isAgent" : false } }, "ts" : 1679325479470.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "_id" : ObjectId("64187943bb85a6727df80efc"), "room" : "CHAT_DEFAULT_df3b98ab-4a53-4d1f-8138-c3b45a58c9a0" }
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
{ "data" : { "replyTo" : "223908fd-93ce-432d-b3b2-0b4f90b70c74", "id" : "wamid.HBgMMzkzNDAzNjA5MTY5FQIAEhggMTdBREMzMjJGRjJDRDU2RjY5NUVFMDM4RDBFQTBBQTQA", "messageType" : "REACTION", "content" : { "emoji" : "👍🏻", "user" : { "id" : "393403609169", "isAgent" : false } }, "ts" : 1679329738463.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "room" : "CHAT_DEFAULT_c1201fe5-e653-4540-a766-b583bfeb4c8c" }
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
{ "data" : { "replyTo" : "", "id" : "wamid.HBgMMzkzNDAzNjA5MTY5FQIAEhggMUMzQUREMEI1NzAzMDkyOTc1NTUwOUVBNERENkM0QTUA", "messageType" : "CONTACTS", "content" : { "contacts" : [ { "name" : { "first_name" : "Felice Griffi", "formatted_name" : "Felice Griffi" }, "phones" : [ { "phone" : "+39 339 366 9393", "wa_id" : "393393669393", "type" : "Cellulare" } ] }, { "name" : { "first_name" : "Giulia Cavazzana", "formatted_name" : "Giulia Cavazzana" }, "phones" : [ { "phone" : "+39 039 606 6024", "type" : "Casa" }, { "phone" : "+39 347 192 6356", "wa_id" : "393471926356", "type" : "Cellulare" } ] } ], "user" : { "id" : "393403609169", "isAgent" : false } }, "ts" : 1679329765410.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "room" : "CHAT_DEFAULT_c1201fe5-e653-4540-a766-b583bfeb4c8c" }
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
{ "data" : { "replyTo" : "", "id" : "wamid.HBgMMzkzNDAzNjA5MTY5FQIAEhggNDIzQTgwNjQ5QzFCMkNFRDI1MzA5QTQzQjEyQzM3MTkA", "messageType" : "LOCATION", "content" : { "address" : "Via pascoli, Bellusco, Lombardia", "latitude" : 45.618205788846, "longitude" : 9.4231867131938, "name" : "Centro sportivo bellusco", "url" : "https://foursquare.com/v/4cf222607bf3b60c0b28647f", "user" : { "id" : "393403609169", "isAgent" : false } }, "ts" : 1679329786335.0, "deliverySuccess" : true, "deliveryErrorReason" : "" }, "_id" : ObjectId("641889f6bb85a6727df80f7b"), "room" : "CHAT_DEFAULT_c1201fe5-e653-4540-a766-b583bfeb4c8c" }
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
{ "data" : { "id" : "c6d3e132-4432-4208-943d-cc2b34ba3107", "messageType" : "videoRequestedByCustomer", "ts" : 1617786830148.0, "deliverySuccess" : true, "deliveryErrorReason" : "", "content" : { "user" : { "isAgent" : false, "id" : "USER_DEFAULT_9a0a411c-f9c7-4af7-9754-024bf157a3ef" }, "audio" : true, "video" : true } }, "_id" : ObjectId("606d7810d6e88353f88732a1"), "room" : "CHAT_DEFAULT_d06723cf-518e-4767-99b6-6d21d5998081" }
videoAccepted message:
{ "data" : { "id" : "715a2213-3123-4718-8266-a489bebc493b", "messageType" : "videoAccepted", "ts" : 1617786834240.0, "deliverySuccess" : true, "deliveryErrorReason" : "", "content" : { "user" : { "isAgent" : true, "id" : "USER_gverde1@acd.enghouse.com" }, "audio" : true, "video" : true } }, "_id" : ObjectId("606d7810d6e88353f88732a0"), "room" : "CHAT_DEFAULT_d06723cf-518e-4767-99b6-6d21d5998081" }
videoStarted message:
{ "data" : { "id" : "cfa53427-1ee7-4e8f-9848-e8e87523aec4", "messageType" : "videoStarted", "deliverySuccess" : true, "deliveryErrorReason" : "", "ts" : 1617786839849.0, "content" : { "user" : { "isAgent" : true, "id" : "USER_gverde1@acd.enghouse.com" }, "audio" : true, "video" : true } }, "_id" : ObjectId("606d7810d6e88353f887329f"), "room" : "CHAT_DEFAULT_d06723cf-518e-4767-99b6-6d21d5998081" }
screenSharingStarted message:
{ "data" : { "id" : "227130be-f490-4ef2-9923-9bb69ad6756c", "messageType" : "screenSharingStarted", "deliverySuccess" : true, "deliveryErrorReason" : "", "ts" : 1617786873764.0, "content" : { "user" : { "isAgent" : true, "id" : "USER_gverde1@acd.enghouse.com" }, "audio" : true, "video" : true } }, "_id" : ObjectId("606d7810d6e88353f887329c"), "room" : "CHAT_DEFAULT_d06723cf-518e-4767-99b6-6d21d5998081" }
videoEnded message:
{ "data" : { "id" : "a8ffdf71-ad3e-4495-ba91-057442df88c0", "messageType" : "videoEnded", "deliverySuccess" : true, "deliveryErrorReason" : "", "ts" : 1617786886374.0, "content" : { "user" : { "isAgent" : true, "id" : "USER_gverde1@acd.enghouse.com" }, "audio" : true, "video" : true } }, "_id" : ObjectId("606d7810d6e88353f887329a"), "room" : "CHAT_DEFAULT_d06723cf-518e-4767-99b6-6d21d5998081" }
endChat message:
Name | Type | Description |
---|---|---|
user | OBJECT | Semplified user object containing only user id and isAgent properties of the user who sent the message. |
Example
{ "data" : { "id" : "b88d3de0-23b8-41d1-95c3-1209dd4c8cff", "messageType" : "endChat", "ts" : 1617786896642.0, "deliverySuccess" : true, "deliveryErrorReason" : "", "content" : { "user" : { "isAgent" : false, "id" : "USER_DEFAULT_9a0a411c-f9c7-4af7-9754-024bf157a3ef" } } }, "_id" : ObjectId("606d7810d6e88353f8873297"), "room" : "CHAT_DEFAULT_d06723cf-518e-4767-99b6-6d21d5998081" }