Receiving Messages
This method allows your server to read the user's reply message in the chat.
For example, after sending an HSM message with chat buttons to a user, when one of the buttons is clicked, the
payload
parameter is returned — the button code specified when creating the HSM message template.
You can test sending messages using the edna Pulse API for the WhatsApp channel without registering the channel.
Testing WhatsApp Channel APIConnection URL
The address should start with HTTPS — HTTPS protocol, port 443.
To read users' reply messages in chats, specify your system's API Endpoint in your personal account during registration, which will process incoming POST requests from the edna API.
Examples
Received text messages
{
"id": 101,
"subject": "test_subject_WA",
"subjectId": 345,
"subscriber": {
"id": 202,
"identifier": "35700000000"
},
"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",
"replyOutMessageId": 5043874,
"replyOutMessageExternalRequestId": "2c2dd5f1-5ad8-449d-9c38-b6bdf288f1e5",
"replyInMessageId": null
}
Received message that is a response to a message with an interactive menu
{
"id": 102,
"subject": "test_subject_WA",
"subjectId": 345,
"subscriber": {
"id": 202,
"identifier": "35700000000"
},
"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",
"replyOutMessageId": null,
"replyOutMessageExternalRequestId": null,
"replyInMessageId": 537701
}
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
}
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": "EUR"
}
]
}
},
"receivedAt": "2024-08-05T12:44:22Z",
"replyOutMessageId": null,
"replyOutMessageExternalRequestId": null,
"replyInMessageId": null
}
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": "35700000000"
},
"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
}
Callbacks for incoming messages with the FLOW
value in the messageContent.type
parameter
[
{
"id": 101,
"subject": "test_subject_WA",
"subjectId": 50520,
"subscriber": {
"id": 4633047,
"identifier": "79997776655"
},
"userInfo": {
"userName": "John Smith",
"firstName": null,
"lastName": null,
"avatarUrl": null
},
"messageContent": {
"type": "FLOW",
"attachment": null,
"location": null,
"referral": null,
"caption": null,
"text": "{\"flow_token\":\"example\"}",
"payload": null,
"story": null,
"items": null,
"contact": null,
"product": null,
"catalog": null,
"order": null
},
"receivedAt": "2025-03-25T12:12:12Z",
"replyOutMessageId": null,
"replyOutMessageExternalRequestId": null,
"replyInMessageId": null
}
]
[
{
"id": 101,
"subject": "test_subject_WA",
"subjectId": 50520,
"subscriber": {
"id": 4633047,
"identifier": "79997776655"
},
"userInfo": {
"userName": "John Smith",
"firstName": null,
"lastName": null,
"avatarUrl": null
},
"messageContent": {
"type": "FLOW",
"attachment": null,
"location": null,
"referral": null,
"caption": null,
"text": "{\"screen_0_Name_0\":\"Ivan\",\"screen_0_Order_number_1\":\"6\",\"screen_0_Choose_a_topic_2\":\"0_order\",\"flow_token\":\"example\"}",
"payload": null,
"story": null,
"items": null,
"contact": null,
"product": null,
"catalog": null,
"order": null
},
"receivedAt": "2025-03-25T12:12:12Z",
"replyOutMessageId": null,
"replyOutMessageExternalRequestId": null,
"replyInMessageId": null
}
]
Request Parameters
Parameter | Data type | Description |
---|---|---|
id | long | Request ID. |
subject | string | Name of the signature. |
subjectId | long | The signature ID. You can find out through the channel list method. |
subscriber | object | Information about the sender of the message. |
subscriber.id | long | The identifier. |
subscriber.identifier | string | Phone number. |
userInfo | object | User information. |
userInfo.userName | string | Name. |
userInfo.firstName | string | Last name. |
userInfo.lastName | string | Middle name. |
userInfo.avatarUrl | string | Avatar. |
messageContent | object | Information about the message. |
messageContent.text | string (optional) | The text of the message. When using WhatsApp Flows, information about Flow will be sent in this parameter. developers.facebook.com |
messageContent.type | string | The type of message. Possible values:- TEXT — text message;- IMAGE — image;- DOCUMENT — document attached to the message;- VIDEO — message containing a video;- AUDIO — a message containing sound;- PRODUCT — a message containing a product;- ORDER — a message containing an order;- LIST_PICKER — WhatsApp interactive menu buttons; - FLOW — message containing WhatsApp Flows. Using WhatsApp Flows |
text | string | Required if ContentType = TEXT , AUTHENTICATION or FLOW |
MessageContent.caption | string (optional) | Name. |
MessageContent.payload | string (optional) | The button code. Specified when creating the HSM template. |
MessageContent.items | object | A set of parameters that are returned in a response message from the client when it responds to a message with an interactive menu. If the client's message is ordinary (for example, text) and is not a response to a message with an interactive menu, the parameter is returned as follows: MessageContent.items = null . |
messageContent.items.title | string (required) | The name of the item in the original interactive menu. |
MessageContent.items.subtitle | string (optional) | The subtitle of the original interactive menu item. |
messageContent.items.identifier | integer (optional) | The end-to-end element ID for the entire message will be returned in the user's reply message. |
messageContent.location | object (optional) | Location address. |
MessageContent.attachment | object (optional) | null or document data. |
MessageContent.attachment.url | string (optional) | URL of the attached image, document, or video. |
MessageContent.attachmentname | string (optional) | The name of the attached image, document, or video. |
MessageContent.attachmentsize | string (optional) | Size. |
MessageContent.contact | object (optional) | A contact card consisting of the fields: first name, last name, and mobile phone. |
contact.firstName | string (optional) | The name in the contact card. |
contact.lastName | string (optional) | Last name in the contact card. |
contact.PhoneNumber | string (optional) | The mobile phone in the contact card. |
receivedAt | string | Date and time of receipt. |
replyInMessageId | long | The internal identifier of the user's quoted message. The user quotes his message sent to the company. |
replyOutMessageId | long | The internal identifier of the quoted message of the company. The user quotes a message received from the company. |
replyOutMessageExternalRequestId | long | The external identifier of the quoted message of the company, which it specifies when sending an outgoing message via the API. In the event that the user quoted a message received from the company. |
You can add to the set of items that are returned as a result of the request. To do this, use the necessary items from the list.
Response parameters
Parameter | Data type | Description |
---|---|---|
messageContent.referral | object | Information obtained from a link hidden from the user or from an advertisement |
MessageContent.referral.body | string | The ad text associated with the message. |
messageContent.referral.headline | string | The title of the ad associated with the message. |
MessageContent.referral.SourceID | string | ID of the Facebook ad or post. |
MessageContent.referral.sourceType | string | Type of the ad source. Possible values: - ad — ad - post — publication |
MessageContent.referral.sourceURL | string | URL of the ad that the user viewed. |