Menu
Introduction Getting started SMS Promotional - Large campaigns Transactional - Basic Transactional (Alerts) - Virtual Number Route Transactional (Alerts) - Priority Routing Transactional (OTPs & Alerts) - Special route International route to Nigeria International route to Other Countries SMS DLR SMS DLR Webhooks Voice Voice OTP Voice Broadcasts Voice DLR Units Transfer Units to Sub-Account Transfer Units to Other Account Check Units Balance Sender IDs Register Sender IDs Check Sender ID status Categories Add Customer Remove Customer Virtual Number Inbox webhook Carrier Billing Run USSD Query Run Shortcode Query Query Status Carrier Callback Tools Create Sub-Account Check DND Status Check Service Status 3rd-party integrations ZOHO
Fetch SMS DLR The API is used when you want to programatically get the delivery status of messages you have sent.
💡 USAGE We advise you to call this API frequently to get the actual delivery status of the messages in realtime. The data would be available to fetch only for 30 days the message is sent.
GET
https://api.textng.xyz/deliveryreport/?key=YOUR-ACCOUNT-KEY&reference=MESSAGE-REFERENCE-NUMBER&req=COMMAND&used_route=MESSAGE-ROUTE
PHP code
<?php
  // Variables
  $key="YOUR-ACCOUNT-KEY";
  $reference="MESSAGE-REFERENCE-NUMBER";
  $req="COMMAND";
  $used_route="MESSAGE-ROUTE";
  $arrContextOptions=array(
        "ssl"=>array(
            "verify_peer"=>false,
            "verify_peer_name"=>false,
        ),
    );
    $data = file_get_contents("https://api.textng.xyz/deliveryreport/?key=$key&reference=$reference&req=$req&used_route=$used_route", false, stream_context_create($arrContextOptions));
    $decode = json_decode($data);
    $extracted_data = $decode->D->details;
    foreach ($extracted_data as $extracted_data_info) {
      echo $phone_number = $extracted_data_info->number;
      echo $status = $extracted_data_info->status;
      echo $track_id = $extracted_data_info->track_id;
    }
?>


POST
https://api.textng.xyz/deliveryreport_post/
PHP code
<?php
  // Your variables
  $key = "YOUR-ACCOUNT-KEY";
  $reference = "MESSAGE-REFERENCE-NUMBER";
  $req = "COMMAND";
  $used_route = "MESSAGE-ROUTE";
  $response = httpPost("https://api.textng.xyz/deliveryreport_post/",array("key"=>"$key","reference"=>"$reference","req"=>"$req","used_route"=>"$used_route"));
  // using php curl
  function httpPost($url, $data) {
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($curl);
    curl_close($curl);
    echo $response;
    $decode = json_decode($response);
    $extracted_data = $decode->D->details;
    foreach ($extracted_data as $extracted_data_info) {
        echo $phone_number = $extracted_data_info->number;
        echo $status = $extracted_data_info->status;
        echo $track_id = $extracted_data_info->track_id;
    }
  }
?>
Parameters
Parameters Example Description
Key XXXXX-XXXX-XXXXX This can be found in the Developers page of your dashboard. The key authorizes the transaction.
Reference XXXXXXXXXX This is the reference number generated for each sms sent. you'll get this in the DLR page, and it is also displayed when you use the API to send message
req All / DND / Success This specifies the type of numbers you want in the report. Valid types of command are:

all: To get both delivered and blocked(if message was sent via route 2)/sent via bypass route numbers seperated and shown in the report

dnd: To get only the numbers that were blocked(if message was sent via route 2) OR messages sent via bypass route

success: To get only the numbers that were delivered to successfully
used_route 2 / 5 / 6 This specifies the message route you used to send the sms you want the report.