Receiving Messages

This method helps your server read a client’s response message in the chat. For example, if a client received an HSM message with chat buttons, if they click one of them, the payload parameter will be returned (the code button that was set when creating a template for the HSM message).

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

URL

For your server to be able to read response messages, during registration, you need to specify your system’s API endpoint that will process incoming POST requests from edna API.

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

Request Example

  • 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"
}
  • 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
idlongRequest ID
subjectstringSubject
subjectIdlongSubject ID. To retrieve the ID, use the channel-profile method.
subscriberobject Sender information
subscriber.idlongSender indetifier
subscriber.identifierstringSender phone number
userInfoobjectSender information
userInfo.userNamestringFirst name
userInfo.firstNamestringLast name
userInfo.lastNamestringPatronymic
userInfo.avatarUrlstringAvatar
messageContentobjectMessage information
messageContent.textstring
(optional)
Message text
messageContent.typestringType of content in the message: text, button, image, document, audio, or vodeo
messageContent.captionstring
(optional)
Title
messageContent.payloadstring
(optional)
Button code specified when creating an HSM template
messageContent.itemsobject Array of parameters that are returned in 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)Title of the element of the original interactive menu
messageContent.items.subtitlestring (optional)Subtitle of the element of the interactive menu
messageContent.items.identifierinteger (required)Element ID for the entire message. This ID is returned in the client’s response message
messageContent.locationobject (optional)Location address
messageContent.attachmentobject (optional)Null or attachment data
messageContent.attachment.urlstring
(optional)
URL of the attached image/document/video
messageContent.attachmentnamestring
(optional)
Name of the attached image/document/video
messageContent.attachmentsizestring
(optional)
Attachment size
receivedAtstringDate and time when the message was received
The list of the elements that are returned as a result of the request might be replenished at our discretion. Please use the elements from the list that you require.
Retrieving Message Statuses
Next Article Sending message read confirmation
In this article