Webhooks

Everything about Webhooks


Request Bin provides you with a URL on which you can check if webhooks for DLR are working properly.


You can follow these steps to see how you will receive the data on your URL:


1. Go to https://requestbin.com/


2. Click on Create a RequestBin or it is recommended to create a Public Bin for testing.

Landing Page for RequestBin


3. Copy the URL

Temporary Testing Webhook URL


4. Paste this URL in the webhooks, and send an SMS


Webhook Option in MSG91 SMS tool


5. Click on the bubble to view the data received on this URL


Response received

For reference: the response will be 

"root":  "data": "[{"senderId":"sndotp","requestId":"3364427XXXXXXXXXX7313839","report":[{"date":"2023-04-28 20:27:05","number":"9188XXXXXXXXX","status":"1","desc":"DELIVERED"}],"userId":"000010","campaignName":"API"}]"

How does the request...

November 12, 2024


A Webhook is a simple call back that is used to notify on the occurrence of an event. It's an HTTP POST that occurs when something happens; a simple event notification via HTTP POST.


It will help you get all the Delivery reports on your desired URL. You can put the URL on which you want to receive the Delivery Reports in the Webhooks and we will post the delivery report there.


For more details on how you can use it, refer to the below-mentioned link:

https://msg91.com/help/how-can-i-get-the-delivery-reports-on-my-webhook-url





What are Webhooks? H...

November 11, 2024


Follow the below-described steps to get the delivery report on your desired webhook URL:

STEP 1. Login to MSG91 panel -> Click on SMS.



STEP 2. Go to the Webhook section and enter your Webhook URL in the box given and select the version of Webhook (v2, v3 or v4). Details of the response received on your Webhook URL in different version is mentioned below and will also be visible in your MSG91 account. 



Webhook Version 2 (v2):


The response is sent with content-type: application/x-www-form-urlencoded


Sample response v2:


{

    "data": "[{\"senderId\":\"uXXXXm\",\"requestId\":\"346XXXXXXXXXXXX130\",\"report\":[{\"date\":\"2024-05-22 10:06:20\",\"amount\":\"0.01\",\"clientid\":\"\",\"INMSID\":\"0\",\"CRQID\":\"0\",\"ctCode\":\"900\",\"number\":\"9195XXXX6558\",\"credit\":\"1\",\"status\":\"1\",\"desc\":\"DELIVERED\",\"failedReason\":\"\"}],\"userId\":\"27XXXX\",\"campaignName\":\"Sendhttp\"}]"

}


Webhook Version 3 (v3):


The response is sent with content-type: application/json, this version is generally used if you are using platforms like Moengage, Webengage etc, to send messages.

Sample response v3:

{

    "date": "2024-05-22 09:58:16",

    "number": "9195XXXX6558",

    "senderId": "uXXXXm",

    "amount": "0.01",

    "requestId": "346XXXXXXXXXXXX130",

    "INMSID": "0",

    "CRQID": "0",

    "credit": "1",

    "userId": "27XXXX",

    "campaignName": "Sendhttp",

    "status": "1",

    "desc": "DELIVERED"

}


Webhook Version 4 (v4)


This version is generally selected if you are using Clevertap platform to send messages. The response is sent with content-type: application/json


Sample response v4:


[{"data":[{"meta":"0","INMSID":"0","description":"DELIVERED","ts":1726729500}],"event":"delivered"}]


STEP 3. Now our system will automatically push the delivery report to the saved URL on a real-time basis. 


STEP 4. On your Webhook URL, we will push the description as well as the status of the Request ID(s). Please find below the description with the status.


Status

Description

1

Delivered

2

Failed

9

NDNC (In case of Promotional SMS only)

16 & 25

Rejected

17

Blocked number


                                     

Note:- 

For debugging or demo purposes you can use https://public.requestbin.com/ or https://httpdump.app to have a testing callback URL.


Additional Features:


1. To obtain additional values in the webhook response, you have the option to include a custom parameter named "CRQID" in the API. However, please note that the "CRQID" parameter only allows alphanumeric values and does not support spaces or special characters. 


It is applicable for all versions of SMS API.


Note: Maximum characters allowed in CRQID: 52 characters.


Sample Payloads V5 or FLOW API:


{

    "flow_id": "60b07XXXXXXXXXXXXXXX",

    "sender": "TESTIN",

    "recipients": [

        {

            "mobiles": "919999999999",

            "var": "XYZ",

            "CRQID": "Beta1"

        },

        {

            "mobiles": "91888888888",

            "var": "XYZ",

            "CRQID": "Beta2"

        }

    ]

}


Output:


data= [{"senderId":"TESTIN", "requestId": "33666c73574c303830353738", "report": [{"date": "2023-06-12 19:49:39", "number": "919999999999", "clientid":''12345", "CRQID": "Beta1", "status": "1", "desc" :"DELIVERED"}], "userId": "12345", "campaignName": "API"'}]


data= [{"senderId":"TESTIN", "requestId": "33666c73574c303830353738", "report": [{"date": "2023-06-12 19:49:39", "number": "91888888888", "clientid":''12345", "CRQID": "Beta2", "status": "1", "desc" :"DELIVERED"}], "userId": "12345", "campaignName": "API"'}]


Note: Different CRQID values will only be received in the case of custom messages, meaning different messages for different numbers.


2. We started showing the failure reason of any SMS request on Webhook. The sample response will look like below:


data= [{"senderId":"TESTIN","requestId":"33666d73756c393431393033","report":[{"date":"2023-06-13 19:21:13","number":"91888888888","clientid":"12345","CRQID":"Beta2","status":"2","desc":"FAILED", "failedReason":"Template Inactive on DLT"}],"userId":"12345","campaignName":"API"}]


Please note : Webhook will not be sent for following API failure error codes


- 301 : Insufficient Balance

- 203 : Invalid Sender ID 

- 211 : Empty DLT ID (Template ID or PE ID)

Try webhook.site to test this service.





How to use Webhook t...

Invalid Date