Delivery Notifications
When a message is sent by business using API Call, its generally accepted by RBM for processing if complies to JSON format specification.
Message Accepted Response
When a message is sent using API, RBM accepts for processing and message is assigned with a message_id
which is returned in the API Call response in JSON format as given below:
{"code": 200,"message": "Message request has been created","message_id": "{String}"}
Delivery Notification Posts
Once its accepted, RBM tries to deliver the message to user. Therefore, status of the message is updated time to time. Subsequently all delivery status updates are posted to the Webhook against this message_id
.
Delivery & Message Status
An outbound message's status may be changed to one of the follwoing at related event/stage.
Status | Description |
---|---|
SENT | Message has been queued for sending. |
FAILED | RBM failed to deliver message. |
REVOKED | Message is withdrawn from RBM queue either by API Call or got expired after ttl or expire_time |
DELIVERED | Message has been delivered to user. |
READ | It's a read receiipt that the message is read by the user. |
Webhook Payload
Delivery Status Updates JSON: An Outgoing Message changes it’s status in its life time as it passes through different stages until its read by the user. All updates on Deliver Status are notified on Webhook in the following format:
{"phone": '{String}',"agent": '{String}',"type": 'message',"message": {"message_id": '{String}',"status": '{String}',"failure_reason": '{String}'},"timestamp": '{String}',}
JSON Explanation
|Key| Data Type|Description|
|------------|-----------|-------------|-------------|
|phone
|String | End User Phone No. Format: +6599999999 (65 is the Country Code, 99999999 is Phone No.)|
|agent
|String |RBM Agent Name|
|type
|String | Value message
stands for Message Delivery Status. |
|message
| Object | Contains Message Infomration against which Status is being received. |
|timestamp
|String | Timestamp in UTC. Format: 2024-06-24T06:42:16.950Z|
Object Definition: For message
Object
|Key| Data Type|Description|
|------------|-----------|-------------|-------------|
|message_id
|String | Unique Message ID of the original message against which the status update being received.|
|status
|String | Enumerated data: SENT, FAILED, READ, REVOKED, DELIVERED|
|failure_reason
|String |Optional. Appears only for status: FAILED
. Descriptive reason for delivery failure.|
Acknowledgement
Any delivery notification received at Webhook must be acknowledged by returning HTTP 200 header in the same connection.
Refer the example below written in PHP, to return HTTP 200 header.
<?phpheader("HTTP/1.1 200 OK");?>