Message Delivery Status

In this section, you will be acquainted with receiving notification of your message delivery updates.
You may configure webhook URLs for receiving the delivery reports of the outgoing message. Unifonic's conversation platform allows you to configure multiple webhook URLs for each and every event type. In case webhooks are not sufficient, you may also make use of our API to retrieve message status update.

📘

Webhooks are necessary if...

you are embedding Unifonic Conversation APIs with third party chatbot/agent console. Without webhooks, you will not get your incoming messages in real time.

Configuring Webhook URLs

  1. Navigate to the Channels > WhatsApp.

  1. Click the Edit button, and navigate to the WEBHOOK tab.

  1. Click on the top right green button - ADD NEW to paste the webhook URL on which the user would like to receive the incoming webhook responses for message delivery updates

Sample: Message Sent Successfully to Provider (Meta)

{
  "messageId": "b322a549-0b12-48e8-XXXX-XXXXXXXXXX",
  "eventId": "34XX2adc-c166-XXXX-8348-c67XXXXXXXe9",
  "eventType": "message.sent_successfully_to_provider",
  "applicationId": "7d0dd3we-2da0-XXXX-82A1-XXXXXXXf019",
  "conversationId": "dc223gs5-XXX0-4701-XXXb-XXXX38gsdl6",
  "recipient": {
    "channel": "whatsapp",
    "contact": "+966XXXXXXX"
  },
  "timestamp": "2023-05-02T11:36:51.000Z",
  "receivedAt": "2023-05-02T11:36:51.626Z"
}

Sample: Message Sent

{
  "messageId": "b322a549-0b12-48e8-XXXX-XXXXXXXXXX",
  "eventId": "34XX2adc-c166-XXXX-8348-c67XXXXXXXe9",
  "eventType": "message.sent",
  "applicationId": "7d0dd3we-2da0-XXXX-82A1-XXXXXXXf019",
  "conversationId": "dc223gs5-XXX0-4701-XXXb-XXXX38gsdl6",
  "recipient": {
    "channel": "whatsapp",
    "contact": "+966XXXXXXX"
  },
  "timestamp": "2023-05-02T11:36:51.000Z",
  "receivedAt": "2023-05-02T11:36:51.626Z"
}

Sample: Message Delivered

{
  "messageId": "b322a549-0b12-48e8-XXXX-XXXXXXXXXX",
  "eventId": "34XX2adc-c166-XXXX-8348-c67XXXXXXXe9",
  "eventType": "message.delivered",
  "applicationId": "7d0dd3we-2da0-XXXX-82A1-XXXXXXXf019",
  "conversationId": "dc223gs5-XXX0-4701-XXXb-XXXX38gsdl6",
  "recipient": {
    "channel": "whatsapp",
    "contact": "+966XXXXXXX"
  },
  "timestamp": "2023-05-02T11:36:51.000Z",
  "receivedAt": "2023-05-02T11:36:51.626Z"
}

Sample: Message Read

{
  "messageId": "b322a549-0b12-48e8-XXXX-XXXXXXXXXX",
  "eventId": "34XX2adc-c166-XXXX-8348-c67XXXXXXXe9",
  "eventType": "message.read",
  "applicationId": "7d0dd3we-2da0-XXXX-82A1-XXXXXXXf019",
  "conversationId": "dc223gs5-XXX0-4701-XXXb-XXXX38gsdl6",
  "recipient": {
    "channel": "whatsapp",
    "contact": "+966XXXXXXX"
  },
  "timestamp": "2023-05-02T11:36:51.000Z",
  "receivedAt": "2023-05-02T11:36:51.626Z"
}

Sample: Message Rejected

{
  "messageId": "b322a549-0b12-48e8-XXXX-XXXXXXXXXX",
  "eventId": "34XX2adc-c166-XXXX-8348-c67XXXXXXXe9",
  "eventType": "message.rejected",
  "applicationId": "7d0dd3we-2da0-XXXX-82A1-XXXXXXXf019",
  "conversationId": "dc223gs5-XXX0-4701-XXXb-XXXX38gsdl6",
  "recipient": {
    "channel": "whatsapp",
    "contact": "+966XXXXXXX"
  },
  "failReason": "invalid_contact",
  "timestamp": "2023-05-02T11:36:51.000Z",
  "receivedAt": "2023-05-02T11:36:51.626Z"
}

📘

Missing status?

For a status to be read, it must have been delivered. In some scenarios, such as when a user is in the chat screen and a message arrives, the message is delivered and read almost simultaneously. In this or other similar scenarios, the delivered notification will not be sent back, as it is implied that a message has been delivered if it has been read. The reason for this behavior is internal optimization.

Get message status

There are some unfortunate moments when the webhook notification does not get logged into your system. This could be due to multiple reasons. However, since a webhook notification system operates on a "fire and forget" model, if the notification is not received and logged, then you may find missing message delivery statuses.

To resolve such incidents, you can make use of our API to retrieve a message status. There are two methods:

  • Get message status via messageId
  • get message status via referenceId

GET/message/status?messageId={messageId}

Sample Request

curl --location 'https://apis.unifonic.com/v1/messages/status?messageIds=SD92380djf-83fe-4230-8ssc-59wlvpoka124' \
--header 'PublicId: XXXXXX' \
--header 'Secret: XXXXX' \
--header 'Content-Type: application/json'

Sample Response:

[
    {
        "messageId": "SD92380djf-83fe-4230-8ssc-59wlvpoka124",
        "contact": "+966555555555",
        "channel": "whatsapp",
        "sentAt": "2023-07-22T20:02:03.375Z",
        "senderApplicationId": "ecwewee97-7w4b-sdsd-44e5-e333333333c",
        "status": "REJECTED",
        "statuses": [
            {
                "status": "QUEUED",
                "createdAt": "2023-07-22T20:02:02.729Z"
            },
            {
                "status": "REJECTED",
                "createdAt": "2023-07-22T20:02:05.000Z"
            }
        ],
        "referenceId": null
    }
]

GET/message/status_by_ref_id?referenceId={referenceId}

  • the endpoint should be https://apis.unifonic.com (contact customer support if this endpoint does not work for you)
  • this query only works if you have specified a referenceId in your original request payload to send a WAB outbound message

Sample Request

curl --location 'https://apis.unifonic.com/v1/messages/status_by_ref_id?referenceIds=sdsdsdsdwrjf-83fe-4230-8ssc-59wlvpoka124' \
--header 'PublicId: XXXXXX' \
--header 'Secret: XXXXX' \
--header 'Content-Type: application/json'

Sample Response:

[
    {
        "messageId": "5239834734f-9000-231b-23a5-4b340difkl54",
        "referenceId": "sdsdsdsdwrjf-83fe-4230-8ssc-59wlvpoka124",
        "sentAt": "2023-07-13T15:00:22.012+00:00",
        "status": "QUEUED",
        "senderApplicationId": "ecwewee97-7w4b-sdsd-44e5-e333333333c",
        "channel": "whatsapp",
        "contact": "+96655555555",
        "statuses": [
            {
                "status": "QUEUED",
                "createdAt": "2023-07-13T15:00:22.007+00:00"
            }
        ]
    }
]

What’s Next