Delivery reports on Notify URL
Receive Delivery reports and custom data on your callback server's Notify URL.
Unlike the Getting delivery reports API method, where the reports are pulled and received in the response, you are able to set a Notify URL on your callback server to which we will push the delivery reports.
Notify URL is set as one of the parameters of the Fully-featured textual message API method.
As soon as the delivery reports for sent messages are received in the Infobip system, they will be forwarded to the specified Notify URL on your callback server. Besides the Notify URL, you can also specify notify content type for delivery reports.
Supported content types:
application/json
application/xml
For every sent message you can set a customized bulk id and message id so each delivery report pushed to the Notify URL will have the same messageId
and bulkId
attributes as the message for which it is being sent. If you don’t use customized messageId
and bulkId
, these delivery reports attributes will be generated by the Infobip system.
Apart from the custom bulk id and message id that can identify sent messages, you are able to set callbackData
as additional, user defined data that will be sent to the Notify URL. Callback data is also set as one of the parameters of the Fully-featured textual message API method.
The example below shows how to set notifyURL
and notifyContentType
for the delivery report and the user’s callbackData
for SMS.
POST /sms/1/text/advanced HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
{
"bulkId":"BULK-ID-123-xyz",
"messages":[
{
"from":"InfoSMS",
"destinations":[
{
"to":"41793026727",
"messageId":"MESSAGE-ID-123-xyz"
},
{
"to":"41793026731"
}
],
"text":"Mama always said life was like a box of chocolates. You never know what you're gonna get.",
"notifyUrl":"http://www.example.com/sms/advanced",
"notifyContentType":"application/json",
"callbackData":"There's no place like home."
}
]
}
The results you will receive on your Notify URL will be the same as Getting delivery reports over the API method, except the XML root element name which is the same for all reports - <reportResponse>
.
{
"results": [
{
"bulkId": "BULK-ID-123-xyz",
"messageId": "c9823180-94d4-4ea0-9bf3-ec907e7534a6",
"to": "41793026731",
"sentAt": "2015-06-04T13:01:52.933+0000",
"doneAt": "2015-06-04T13:02:00.134+0000",
"smsCount": 1,
"mccMnc": "21901",
"price": {
"pricePerMessage": 0.0001000000,
"currency": "EUR"
},
"status": {
"groupId": 3,
"groupName": "DELIVERED",
"id": 5,
"name": "DELIVERED_TO_HANDSET",
"description": "Message delivered to handset"
},
"error": {
"groupId": 0,
"groupName": "OK",
"id": 0,
"name": "NO_ERROR",
"description": "No Error",
"permanent": false
},
"callbackData":"There's no place like home."
},
{
"bulkId": "BULK-ID-123-xyz",
"messageId": "MESSAGE-ID-123-xyz",
"to": "41793026727",
"sentAt": "2015-06-04T13:01:52.937+0000",
"doneAt": "2015-06-04T13:02:01.204+0000",
"smsCount": 1,
"mccMnc": "21901",
"price": {
"pricePerMessage": 0.0001000000,
"currency": "EUR"
},
"status": {
"groupId": 3,
"groupName": "DELIVERED",
"id": 5,
"name": "DELIVERED_TO_HANDSET",
"description": "Message delivered to handset"
},
"error": {
"groupId": 0,
"groupName": "OK",
"id": 0,
"name": "NO_ERROR",
"description": "No Error",
"permanent": false
},
"callbackData":"There's no place like home."
}
]
}
The example below shows how to set notifyURL and notifyContentType for the delivery report and the user’s callbackData for EMAIL.
curl -s --user user:password \
https://{base_url}/email/1/send \
-F from='Jane Smith <jane.smith@somecompany.com>' \
-F to='john.smith@somedomain.com' \
-F replyTo='all.replies@somedomain.com' \
-F subject='Mail subject text' \
-F text='Mail body text' \
--form-string html='<h1>Html body</h1><p>Rich HTML message body.</p>' \
-F attachment=@files/image1.jpg \
-F bulkId='customBulkId' \
-F intermediateReport='true' \
-F notifyUrl='https://www.example.com/email/advanced' \
-F notifyContentType = 'application/json' \
-F callbackData = 'DLR callback data'
The result you will receive on your Notify URL will be the same as Getting delivery reports over the API method, except the XML root element name which is the same for all reports - <reportResponse>
.
{
"results":[
{
"bulkId":"customBulkId",
"price":{
"pricePerMessage":0.000000,
"currency":"EUR"
},
"status":{
"id":5,
"groupId":3,
"groupName":"DELIVERED",
"name":"DELIVERED_TO_HANDSET",
"description":"Message delivered to handset"
},
"error":{
"id":0,
"name":"NO_ERROR",
"description":"No Error",
"groupId":0,
"groupName":"OK",
"permanent":false
},
"messageId":"rqes6dajrqqi2sjcvqj8",
"doneAt":"2019-04-30T21:56:39.469+0530",
"smsCount":1,
"sentAt":"2019-04-30T21:56:34.863+0530",
"browserLink":"http:\/\/tracking.infobiiip.com\/render\/content?id=8663ABF1FE6C5312850F6F0E8DCF3A60C7FADBA743973A43A908111387AA14CB0E349818B8A9B2A3971EB1D4307B68FC",
"callbackData":"DLR callback data",
"to":"john.smith@somedomain.com"
}
]
}
Delivery report push retry cycle
If your Notify URL is unavailable for any reason, forward attempts will be made according to this formula: 1min + (1min * <retryNumber/> * <retryNumber/>)
. Examples for the first few retry attempts are shown in the table below. Maximum number of retries is 20, i.e. the last retry will be done 41:30h after the initial one. If your URL is not available for the entire time, delivery reports will be lost and the only way you’ll be able to get them is by Getting SMS logs.
Retry number | Interval | Cumulative |
---|---|---|
0 | 01min | 00:01h |
1 | 02min | 00:03h |
2 | 05min | 00:08h |
3 | 10min | 00:18h |
4 | 17min | 00:35h |
5 | 26min | 01:01h |
6 | 37min | 01:38h |
Delivery report sender IP addresses
In case you need to whitelist our IPs on your system, here is the list of addresses we are using to deliver incoming messages and delivery reports.
- 193.105.74.58
- 62.140.31.58
- 149.5.186.4
- 197.157.66.28
- 185.255.8.58
- 180.179.146.68
- 185.255.9.58
- 81.23.249.58