DLR [GET/POST]: Pull Delivery Report for a Message
End Point
https://otp.ng/api/dlr/
Submit OTP DLR requests to the end point. All the requests are submitted through HTTPS POST/GET method. Although you can use HTTP protocol, we strongly recommend you to submit all requests to API over HTTPS so the traffic is encrypted and the privacy is ensured.
PULLING OTP DLR PARAMETERS
Parameter | Type | Description |
---|---|---|
apikey | String | The unique string to authenticate request. Generate, validate and manage apikeys API Tokens |
msgid | String |
The unique identifier of the message |
OTP DLR Request Format (HTTPS POST Method)
Sample Code to pull OTP DLR through HTTPS POST call to the OTP API
<?php
$endpoint = 'https://otp.ng/api/dlr?';
$dlrArray = array (
'msgid'=> 'otp_20200114_XxxXXXxxXXXxxxXX',
'apikey' => 'API_KEY_HERE',
);
$params = http_build_query($dlrArray);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$response = curl_exec($ch); curl_close($ch);
echo $response; // response code
?>
OTP Request Format (HTTPS GET Method)
Snippet to pull OTP DLR through HTTPS GET call to the API
<?php
$msgid = 'MSGID_HERE';
$endpoint = 'https://otp.ng/api/dlr/';
$pull_dlr = $endpoint.'&apikey='.$apikey.'&msgid='.$msgid;
$response = file_get_contents($pull_dlr);
echo $response;
?>
OTP Response Format
All response are in the format below:
{json data}
Possible Response Codes
On Success
{
"to":"23490XXXXX",
"from":"OTP",
"message":"Here is your OTP: XXXXXX",
"cost":"XXXX",
"status":"DELIVERED",
"description":"Message delivered to phone",
"timesent":"2020-01-14 11:41:40",
"timedone":"2020-01-14 11:41:39",
"msgid":"XXXXXXXXXXXxxxxxXXXXxx",
"refid":"xxxxxxxxxx"
}
On Failure
{
"success": false,
"comment": "Reason for error",
}
Parameters | Type | Description |
success | Boolean | Sets to false |
comment | String | Description for failure |