Retrieve an individual delivery report (or combined reports), which shows the current known status of messages sent in a given time period, or for a particular campaign orcampaigns.
Conversely, the function getDeliveryReports gets a list of available delivery report names, including delivery reports for campaigns.
| Tip |
|---|
Messages sent with the API can be given a 'tag'. The getDeliveryReport function allows you to specify that tag in order to restrict your search.
|
To get the contents of a delivery report for the campaign name 'mycampaign-020411':
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
$result = $tmClient->getDeliveryReport('mycampaign-020411');
|
To get the delivery report details for 'mycampaign-020411' between 01:00 and 02:00 on 1st Jan 2011:
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
$result = $tmClient->getDeliveryReport('mycampaign-020411', '2011-01-01T01:00:00+00:00', '2011-01-01T02:00:00+00:00');
|
Or, between 01:00 on 1st Jan 2011 and now:
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
$result = $tmClient->getDeliveryReport('mycampaign-020411', '2011-01-01T01:00:00+00:00', time());
|
To get delivery report details for all campaigns and API sends between the same dates as the previous 2 examples:
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
$result = $tmClient->getDeliveryReport('all', '2011-01-01T01:00:00+00:00',
'2011-01-01T02:00:00+00:00');
$result = $tmClient->getDeliveryReport('all', '2011-01-01T01:00:00+00:00', time());
|
To get a delivery report with the name 'mycampaign-020411', restricted to those messages sent with custom tag 'test':
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
$result = $tmClient->getDeliveryReport('mycampaign-020411', null, null, 'test'); |
To get the status of messages from all delivery reports for messages sent with custom tag 'test':
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
$result = $tmClient->getDeliveryReport('all', null, null, 'test'); |
The same as the previous 2 examples, but between 2 dates:
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
$result = $tmClient->getDeliveryReport('mycampaign-020411', '2011-01-01T01:00:00+00:00',
'2011-01-01T02:00:00+00:00', 'test');
$result = $tmClient->getDeliveryReport('all', '2011-01-01T01:00:00+00:00', time(), 'test'); |
A complete example, including output:
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
$result = $tmClient->getDeliveryReport('all');
foreach ($result as $key => $report)
{
echo "Report number $key: Name {$report['name']}, Last Updated {$report['last_updated']} <br/>\n";
foreach ($report['reportrow'] as $key => $reportrow){
echo "Message ID: {$reportrow['message_id']}, number:{$reportrow['mobile_number']},
Status:{$reportrow['status']}, Updated:{$reportrow['last_updated']}<br/>\n";
}
} |
| Warning | ||
|---|---|---|
| ||
Our example code is an illustration of how you might integrate with our systems and is not certified for production environments. You are responsible for testing and QA. |