Receiving Messages

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).

You can test receiving messages to a test phone number using the edna API for the WhatsApp channel without registering your channel first. To do this, go to the Testing tab on the Integration page.

Connection URL

Only the HTTPS protocol is supported, so the address must start with HTTPS, port 443.

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"
}

Request Parameters

ParameterData typeDescription
idlongThe request ID.
subjectstringThe subject.
subjectIdlongThe subject ID. To retrieve the ID, use the channel-profile method.
subscriberobject The sender information.
subscriber.idlongThe sender identifier.
subscriber.identifierstringThe sender phone number.
userInfoobjectThe sender information.
userInfo.userNamestringThe first name.
userInfo.firstNamestringThe last name.
userInfo.lastNamestringThe patronymic.
userInfo.avatarUrlstringThe avatar.
messageContentobjectThe message information.
messageContent.textstring
(optional)
The message text.
messageContent.typestringThe type of content in the message: text, button, image, document, audio, or video.
messageContent.captionstring
(optional)
The title.
messageContent.payloadstring
(optional)
The button code specified when creating an HSM template.
messageContent.itemsobject 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.titlestring (required)The title of the element of the original interactive menu.
messageContent.items.subtitlestring (optional)The subtitle of the element of the interactive menu.
messageContent.items.identifierinteger (required)The element ID for the entire message. This ID is returned to the client’s response message.
messageContent.locationobject (optional)The location address.
messageContent.attachmentobject (optional)Null or attachment data.
messageContent.attachment.urlstring
(optional)
The URL of the attached image/document/video.
messageContent.attachmentnamestring
(optional)
The name of the attached image/document/video.
messageContent.attachmentsizestring
(optional)
The attachment size.
messageContent.contactobject (optional)The contact card consisting of the following fields: first name, last name, phone number.
contact.firstNamestring
(optional)
The name in the contact card.
contact.lastNamestring
(optional)
The last name in the contact card.
contact.phoneNumberstring
(optional)
The phone number in the contact card.
receivedAtstringThe date and time when the message was received.
replyInMessageIdlongThe internal identifier of the user’s quoted message. The user quotes message sent to the company.
replyOutMessageIdlongThe internal identifier of the company’s quoted message. The user quotes a message received from the company.
replyOutMessageExternalRequestIdlongThe 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.
You can change the set of items that are returned as a result of the request. To do this, use the required items from the list.
Receiving Message Statuses
Next Article Sending message read confirmation