Webhook

Webhook

The DLR Push API allows the delivery report of a sent message to be sent to the client’s specified Webhook URL using the POST method create here. You can create the Webhook URL by following the instructions below:

  • Navigate to the Webhooks section and create a new Webhook.
  • Upon creation, you will receive an id for the newly created Webhook.

To request delivery reports, include the webhook_id parameter and its corresponding value in your API Request. Once the request is made, you will receive the delivery report as shown below.


  curl -X POST \
  https://www.domain.com/ack/receive \
  -H 'content-type: application/json' \
  -H "Authorization: Bearer %token%", \
  -d '{
      "id": "b34e35ad-fe34-4a8b-977c-b21cd76cd7d6:1",
      "mobile": "918921269xxx",
      "status": "DELIVRD",
      "credits": "2.0000",
      "units": 2,
      "deliv_at": "1701086585",
      "sent_at": "1701063180",
      "submit_at": "1701059582",
      "deliv_time": "2021-04-09 16:27:51",
      "sent_time": "2021-04-09 16:27:35",
      "submit_time": "2021-04-09 16:27:39",
      "cid": "1234444XXXX",
      "custom": "9882XXXX",
    }'
  • The response codes other than 200 or 202 are not taken into consideration and requests for such response codes are considered as failed.

  • The method used for sending the delivery report onto the client’s URL is POST.

We try 3 times with interval of 30 minutes for failed requests. Continues failure requests will be ignored.

For users seeking enhanced customization, compose webhook will help to receive the customized webhook payload to precisely match your preferences and requirements.

Compose

  • Navigate to the Webhooks section and click on the Compose Webhook.
  • Give the identification name.
  • To set up the Compose Webhook, you need to provide a callback URL. This URL is where the composed payload will be sent.
  • In the url you can pass the replaced variables.
  https://www.domain.com/ack/receive?id={{id}}&mobile={{mobile}}&status={{status}}  
  https://www.domain.com/ack/receive?message_id={{id}}&mobile_number={{mobile}}&message_status={{status}}
  • HTTP Method: Specify the HTTP method for the webhook request, such as GET, POST or PUT.
  • Headers: Define custom headers if needed, like Authorization headers or custom headers.
  • Body Format: Choose between JSON or FormData for the payload.
  • Upon creation, you will receive an id for the newly created Webhook.
  • To request delivery reports, include the webhook_id parameter and its corresponding value in your API Request. Once the request is made, you will receive the delivery report as you configured.
  • here keys you can give any name but value should be availebe in the below replaced variable.
  curl -X POST \
  https://www.domain.com/ack/receive?id={{id}} \
  -H 'content-type: application/json' \
  -H "Authorization: Bearer %token%", \
  -d '{
      "id": "{{id}}",
      "mobile": "{{mobile}}",
      "message_status": "{{status}}",
      "credits": "{{credits}}",
    }'

Below Replaced Parameters can be used while creating or composing a webhook

Name Description
id Message Id generated by us
mobile Mobile number with country code
status Message Status
credits Credits charged per sms
units Number of sms parts
deliv_time Delivery time in date format (yyyy-mm-dd H:i:s)
sent_time Request received time in date format (yyyy-mm-dd H:i:s)
submit_time Sent to operator time in date format (yyyy-mm-dd H:i:s)
deliv_at Delivery time in unixtimestamp
sent_time Request received time in unixtimestamp
submit_time Sent to operator time in unixtimestamp
custom Your custom id