This command will generate a delivery report for an entire batch send.
Note: Generating large reports may take several seconds.
https://api.txtlocal.com/status_batch/
<?php // Account details $apiKey = urlencode('Your apiKey'); // Message Details $batch_id = '123456'; // Prepare data for POST request $data = array('apikey' => $apiKey, 'batch_id' => $batch_id); // Send the POST request with cURL $ch = curl_init('https://api.txtlocal.com/status_batch/'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process your response here echo $response; ?>
<?php // Account details $apiKey = urlencode('Your apiKey'); // Message Details $batch_id = '123456'; // Prepare data for POST request $data = 'apikey=' . $apiKey . '&batch_id=' . $batch_id; // Send the GET request with cURL $ch = curl_init('https://api.txtlocal.com/status_batch/?' . $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process your response here echo $response; ?>
<?php require('Textlocal.class.php'); $Textlocal = new Textlocal(false, false, 'your apiKey'); $batch_id = 123456; $response = $Textlocal->getMessageStatus($batch_id); print_r($response); ?>
batch_id | ID of the batch you’d like to generate a report for. Found in the response for the send command, and is the batch ID, not the message ID. The batch ID is also available from the "get message history" API calls. |
---|---|
Login Parameters (Additional Information) | |
apiKey | You can create these in your Messenger Control Panel (click here) for each application, and limit the usage of them by host IP Address. |
{ "batch_id":136546495, "num_messages":2, "num_delivered":2, "num_undelivered":0, "num_expired":0, "num_unknown":0, "num_invalid":0, "messages":[{ "recipient":447123456789, "status":"D" }, { "recipient":447987654321, "status":"D" }], "status":"success" }
<?xml version="1.0" encoding="UTF-8" ?> <response> <batch_id>136546495</batch_id> <num_messages>2</num_messages> <num_delivered>2</num_delivered> <num_undelivered>0</num_undelivered> <num_expired>0</num_expired> <num_unknown>0</num_unknown> <num_invalid>0</num_invalid> <messages> <message> <recipient>447123456789</recipient> <status>D</status> </message> <message> <recipient>447987654321</recipient> <status>D</status> </message> </messages> <status>success</status> </response>
Error Codes | |
26 | Invalid batch ID. |
---|---|
27 | No batch ID specified. |