This method helps your server to read a client’s response message in chat. For example, if a client receives an HSM message with chat buttons, when they click on one of them, the payload parameter is returned (the code button that was set when a template was created for the HSM message).
Connection URL
In order for your server to be able to read response messages, you should specify your system’s API endpoint during registration, which will handle incoming POST requests from the edna API.
Request Example
An example of a received text message.
{ "id": 101, "subject": "test_subject_WA", "subjectId": 234, "subscriber": { "id": 202, "identifier": "79000000000" }, "userInfo": { "userName": "alex", "firstName": null, "lastName": null, "avatarUrl": null }, "messageContent": { "type": "TEXT", "attachment": null, "location": null, "caption": null, "text": "Thank you for your help", "payload": null, "story": null, "items": null }, "receivedAt": "2022-04-29T15:30:08Z" }
An example of a received message that is a response to a message with an interactive menu.
{ "id": 102, "subject": "test_subject_WA", "subjectId": 234, "subscriber": { "id": 202, "identifier": "79000000000" }, "userInfo": { "userName": "alex", "firstName": null, "lastName": null, "avatarUrl": null }, "messageContent": { "type": "LIST_PICKER", "attachment": null, "location": null, "caption": null, "text": null, "payload": null, "story": null, "items": [ { "identifier": "01", "title": "item 1", "subtitle": null } ] }, "receivedAt": "2022-04-29T15:27:40Z" }
An example of an incoming message with the PRODUCT
value in the messageContent.type
parameter.
{ "id": 803101, "subject": "test_subject_WA", "subjectId": 47610, "subscriber": { "id": 4633047, "identifier": "79997776655" }, "userInfo": { "userName": "John Smith", "firstName": null, "lastName": null, "avatarUrl": null }, "messageContent": { "type": "PRODUCT", "attachment": null, "location": null, "caption": null, "text": "Hello", "payload": null, "story": null, "items": null, "contact": null, "product": { "id": "321", "catalogId": "123" }, "catalog": null, "order": null }, "receivedAt": "2024-08-05T08: 24: 14Z", "replyOutMessageId": null, "replyOutMessageExternalRequestId": null, "replyInMessageId": null }
An example of an incoming message with the ORDER
value in the messageContent.type
parameter.
{ "id": 804201, "subject": "test_subject_WA", "subjectId": 47610, "subscriber": { "id": 4633047, "identifier": "79997776655" }, "userInfo": { "userName": "John Smith", "firstName": null, "lastName": null, "avatarUrl": null }, "messageContent": { "type": "ORDER", "attachment": null, "location": null, "caption": null, "text": null, "payload": null, "story": null, "items": null, "contact": null, "product": null, "catalog": null, "order": { "catalogId": "1022121105031922", "products": [ { "id": "111222", "quantity": 2, "price": 5, "currency": "USD" } ] } }, "receivedAt": "2024-08-05T12:44:22Z", "replyOutMessageId": null, "replyOutMessageExternalRequestId": null, "replyInMessageId": null }
An example callback for an incoming message with the referral
parameter. Allows you to get information about where the customer started a conversation in WhatsApp.
{ "id": 115611, "subject": "test_WA", "subjectId": 195, "subscriber": { "id": 1111111, "identifier": "35000000000" }, "userInfo": { "userName": "Anna", "firstName": null, "lastName": null, "avatarUrl": null }, "messageContent": { "type": "TEXT", "attachment": null, "location": null, "referral": { "body": "This is a great product", "headline": "Our new product", "sourceId": "123", "sourceType": "ad", "sourceUrl": "https://www.fb.com" }, "caption": null, "text": "text for test", "payload": null, "story": null, "items": null, "contact": null, "product": null, "catalog": null, "order": null }, "receivedAt": "2024-01-11T11:20:00Z", "replyOutMessageId": null, "replyOutMessageExternalRequestId": null, "replyInMessageId": null }
Request Parameters
Parameter | Data type | Description |
id | long | The request ID. |
subject | string | The subject. |
subjectId | long | The subject ID. To retrieve the ID, use the channel-profile method. |
subscriber | object | The sender information. |
subscriber.id | long | The sender identifier. |
subscriber.identifier | string | The sender phone number. |
userInfo | object | The sender information. |
userInfo.userName | string | The first name. |
userInfo.firstName | string | The last name. |
userInfo.lastName | string | The patronymic. |
userInfo.avatarUrl | string | The avatar. |
messageContent | object | The message information. |
messageContent.text | string (optional) | The message text. |
messageContent.type | string | The type of content in the message: text, button, image, document, audio, video, product, or order. |
messageContent.caption | string (optional) | The title. |
messageContent.payload | string (optional) | The button code specified when creating an HSM template. |
messageContent.items | object | The array of parameters that are returned to the response to a message with an interactive menu. If the received message is not a response to a message with an interactive menu, then messageContent.items is null . |
messageContent.items.title | string (required) | The title of the element of the original interactive menu. |
messageContent.items.subtitle | string (optional) | The subtitle of the element of the interactive menu. |
messageContent.items.identifier | integer (required) | The element ID for the entire message. This ID is returned to the client’s response message. |
messageContent.location | object (optional) | The location address. |
messageContent.attachment | object (optional) | Null or attachment data. |
messageContent.attachment.url | string (optional) | The URL of the attached image/document/video. |
messageContent.attachmentname | string (optional) | The name of the attached image/document/video. |
messageContent.attachmentsize | string (optional) | The attachment size. |
messageContent.contact | object (optional) | The contact card consisting of the following fields: first name, last name, phone number. |
contact.firstName | string (optional) | The name in the contact card. |
contact.lastName | string (optional) | The last name in the contact card. |
contact.phoneNumber | string (optional) | The phone number in the contact card. |
receivedAt | string | The date and time when the message was received. |
replyInMessageId | long | The internal identifier of the user’s quoted message. The user quotes message sent to the company. |
replyOutMessageId | long | The internal identifier of the company’s quoted message. The user quotes a message received from the company. |
replyOutMessageExternalRequestId | long | The external identifier of the company’s quoted message that it specifies when sending an outgoing message via the API if the user quoted a message received from the company. |
Response Parameters
Parameters | Data type | Description |
messageContent.referral | object | The information obtained from a hidden link or advertisement (Viber Bot, WhatsApp). |
messageContent.referral.body | string | The advertisement text associated with the message. |
messageContent.referral.headline | string | The advertisement header associated with the message. |
messageContent.referral.sourceId | string | The ID of the advertisement or Facebook post. |
messageContent.referral.sourceType | string | The advertisement source type. Possible values: • ad : advertisement;• post : post. |
messageContent.referral.sourceUrl | string | The URL of the advertisement that the user viewed. |