DLR Push API

  API-X

Here we describe how OrgDS SMS system relays the delivery report of an API-X sent message to the client’s specified Callback URL through the DLR Push API.

Please note that using DLR Push API, your Callback URL is not making any request. Instead, the URL is waiting for data that will be pushed to it from us via HTTP POST. So you need to create a page on your website that will receive data every time we push delivery report to you.

URL

Your DLR Push page/Callback URL may take this form:

http://www.yourdomain.net/messaging/dlr.php

The DLR Push/Callback URL of an API-X account can be added while creating the account or updated after. Once you set a DLR Push/Callback URL, we will push the parameters explained below to the URL.

NB: To fetch delivery details of messages sent through the main account/API-N, learn about Pull Sent Messages API

DLR Push Parameters


 

DLR Push Response Formats

The response format maybe either JSON or XML, depending on your specification when creating or updating the API-X Sub-account.

JSON Response Format

[
	{
		"messageId":"70b1fa3d8b848",
		"sender":"SampleID",
		"mobileNo":"23480xxxxxxxx",
		"dateTimeSent":"2019-06-10 16:25:02",
		"dateTimeDone":"2019-06-10 16:25:07",
		"msgRoute":"Basic",
		"msgType":"0",
		"mccmnc":"030",
		"networkOperator":"MTN (Nigeria)",
		"msgDlrStatus":"DELIVRD",
		"dlrStatusDescr":"Delivered to SIM",
		"smsPageCount":"1",
		"costPerSMSPage":"1.00",
		"uniqRefId":"ods19-502jy51n2BI0l"
	},
	{
		"messageId":"90b1ha3d8b8b5",
		"sender":"AnotherID",
		"mobileNo":"23490xxxxxxxx",
		"dateTimeSent":"2019-06-10 08:42:27",
		"dateTimeDone":"2019-06-10 15:39:30",
		"msgRoute":"Corporate",
		"msgType":"0",
		"mccmnc":"020",
		"networkOperator":"Airtel (Nigeria)",
		"msgDlrStatus":"DELIVRD",
		"dlrStatusDescr":"Delivered to SIM",
		"smsPageCount":"1",
		"costPerSMSPage":"1.00",
		"uniqRefId":"ods19-20tz1R13Rq70"
	}
]

 

XML Response Format

<?xml version="1.0" encoding="UTF-8" ?>
<responses>
	<report>
	    <messageId>70b1fa3d8b848</messageId>
	    <sender>SampleID</sender>
	    <mobileNo>234806xxxxxxx</mobileNo>
	    <dateTimeSent>2019-06-18 16:26:00</dateTimeSent>
	    <dateTimeDone>2019-06-18 16:26:40</dateTimeDone>
	    <msgRoute>Basic</msgRoute>
	    <msgType>0</msgType>
	    <mccmnc>030</mccmnc>
	    <networkOperator>MTN (Nigeria)</networkOperator>
	    <msgDlrStatus>DELIVRD</msgDlrStatus>
	    <dlrStatusDescr>Delivered to SIM</dlrStatusDescr>
	    <smsPageCount>1</smsPageCount>
	    <costPerSMSPage>1.00</costPerSMSPage>
	    <uniqRefId>ods19-502jy51n2BI0l</uniqRefId>
	</report>
	<report>
	    <messageId>70b1fa3d8b848</messageId>
	    <sender>SampleID</sender>
	    <mobileNo>234805xxxxxxx</mobileNo>
	    <dateTimeSent>2019-06-18 16:26:00</dateTimeSent>
	    <dateTimeDone>2019-06-18 16:26:40</dateTimeDone>
	    <msgRoute>Corporate</msgRoute>
	    <msgType>0</msgType>
	    <mccmnc>020</mccmnc>
	    <networkOperator>Airtel (Nigeria)</networkOperator>
	    <msgDlrStatus>DELIVRD</msgDlrStatus>
	    <dlrStatusDescr>Delivered to SIM</dlrStatusDescr>
	    <smsPageCount>1</smsPageCount>
	    <costPerSMSPage>1.00</costPerSMSPage>
	    <uniqRefId>ods19-20tz1R13Rq70</uniqRefId>
	</report>
</responses>

 

Receiving Push Data

The following PHP code explains how to receive DLR Push on your website.

<?php
//receive POSTED data
$responseBody = file_get_contents('php: //input');//remove space between php: and //input
if (!empty($responseBody)) {
  //decode JSON data and convert to array
  $results = json_decode($responseBody, true);
  /* 
     If the display format of your request is not JSON but XML, you can use the following line to convert the XML response to array instead of the json '$results' above.

     $results = simplexml_load_string($responseBody);
  */
  foreach ($results as $key => $value) {
    //write your DLR processing code here
    //each $key is a Push parameter
    //and the $value is the value of the $key
  }
}
?>