Push DLR
Get instant delivery report as soon as we receive
What is DLR push?
We post data (with all details of delivery report) on your web URL
Benefits over old API
- DLR Push improves speed & efficiency of receiving delivery reports
- It reduces server load, and latency in fetching the reports
DLR push works as follows :
- At first, add your URL to webhooks in your account, it should be an address of the webpage of your application on which you need to receive delivery reports
- Now we start posting the data on this URL as soon as we receive new DLR
What if your server is down for any reason while we posting data?
Don’t worry! We will keep trying to post data in the interval of 1 hour
Sample PHP code
<?php
$request = $_REQUEST["data"];
$jsonData = json_decode($request,true);
$link = mysqli_connect("myhost", "myuser", "mypassw", "mybd") or die("Error " . mysqli_error($link));
foreach($jsonData as $key => $value)
{
// request id
$requestID = $value['requestId'];
$userId = $value['userId'];
$senderId = $value['senderId'];
foreach($value['report'] as $key1 => $value1)
{
//detail description of report
$desc = $value1['desc'];
// status of each number
$status = $value1['status'];
// destination number
$receiver = $value1['number'];
//delivery report time
$date = $value1['date'];
$query = "INSERT INTO mytable (request_id,user_id,sender_id,date,receiver,status,description) VALUES ('" . $requestID . "','" . $userId . "','" . $senderId . "','" . $date . "','" . $receiver . "','" . $status . "','" . $desc . "')";
mysqli_query($link, $query);
}
}
Further you can use above parameters and either update your database or just display it
as per your need .
?>
Need help in generating API?
Fill the URL below to test your PushDLR code
URL *: | (Ex. http://yourdomain.com/dlr/pushUrl.php ) | |
We will hit the URL in following format:
POST
http://yourdomain.com/dlr/pushUrl.php?data=%5B%7B%22requestId%22%3A%22546b384ce51f469a2e8b4567%22%2C%22numbers%22%3A%7B%22911234567890%22%3A%7B%22date%22%3A%222014-11-18%2017%3A45%3A59%22%2C%22status%22%3A1%2C%22desc%22%3A%22DELIVERED%22%7D%7D%7D%5D
Sample data:
POST
data=[ { "requestId":"35666a716868323535323239", "userId":"38229", "report":[ { "desc":"REJECTED", "status":"16", "number":"91XXXXXXXXXX", "date":"2015-06-10 17:09:32.0" } ], "senderId":"tester" }, { "requestId":"35666a716868323535323239", "userId":"38229", "report":[ { "desc":"REJECTED", "status":"16", "number":"91XXXXXXXXXX", "date":"2015-06-10 17:09:32.0" }, { "desc":"REJECTED", "status":"16", "number":"91XXXXXXXXXX", "date":"2015-06-10 17:09:32.0" } ], "senderId":"tester" } ]
Parameter name | Data type | Description |
---|---|---|
reqid | varchar | Request ID (a unique 24 character alphanumeric value for identification of a particular SMS) |
status | numeric | Status of SMS delivery 1=delivered 2=failed 16=rejected |
desc | text | Delivered/Failed/Rejected |
number | numeric (with country code) | Receiver’s Contact Number |
date (YYMMDDhhmm) | string | Displays the delivery time and date of SMS YY: year MM: month DD: date hh: hours mm: minutes |