Check Delivery Reports - Basic Usage
<?php
$key = "ewjd824g"; //Account key. Get it from account settings
$secret = "wwe89rh3qb083r7h30b0d0u8rh033jf39h8r0f3"; //Account secret. Get it from account settings
//Checking the delivery report/status of the message with the ID "kjwihnbf1ri45i256ss"
$message_id = "kjwihnbf1ri45i256ss";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.smsjuice.com/query/{$key}/{$secret}/{$message_id}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
<?php
/**
* Coming Soon!
*/
?>
| Parameter | Description | Required |
|---|---|---|
| key | account authentication key | Required |
| secret | account authentication secret | Required |
| message-id | Message ID for the message whose report is being checked. | Required |
{
"query":"success",
"error":"",
"message_id":"iquis55xruo1na4s",
"message_status":"sent",
"delivery_status":"delivered",
"delivery_time":"2016-08-21 23:06:18.0"
}
| Success Response | Description |
|---|---|
| query | status of the queried message. In this case, success |
| error | Any errors incurred during the process |
| message_id | ID of the message that has been queried |
| message_status | The status showing whether the message has been sent to the recipient or not Possible Values : sent, pending |
| delivery_status | shows whether the message has been delivered or not. Possible Values : delivered, undeliverable, rejected, expired, unknown |
| delivery_time | Show the time at which the delivery status was attained. The only delivery status that does not have a delivery_time is the 'unknown' status |
{
"query": "failed",
"error": "invalid_credentials"
}
| Error Response | Description |
|---|---|
| invalid_credentials | Invalid API key and/or secret |
| invalid_message_id | A message by that ID used to query doesn't exist |
| internal_error | Internal System Error |