Get a list of recipients from a message send. Get up to date information such as opt-out status and delivery status.


Parameter

Description

Required

message_idMessage ID's are made up of digits YES
optouts

Whether to include optouts. Valid options are:



only - only get optouts


omit - do not get optouts


include - get all recipients including optouts (default)


 NO
 pagePage number, for pagination NO
 maxMaximum results returned per page NO
 delivery

Only show messages with requested delivery status. Valid options are:


delivered - only show delivered messages


failed - only show failed messages


pending - only show pending messages


 NO 


Example: Get all message recipients


curl https://api.transmitsms.com/get-sms-sent.json \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret \
  -d message_id=48782


Example: Get all recipients who've opted out


curl https://api.transmitsms.com/get-sms-sent.json \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret \
  -d message_id=48782 \
  -d optouts=only


JSON Response

{    
  page: {
    count: 1,
    number: 1
  },
  total: 2,
  message: {
    message_id: 565645,
    send_at: "2013-06-01 12:34:00",
    recipients: 2,
    list: {
      id: 123,
      name: "BFFs"
    }    
  },
  recipients: [
    {
      first_name: "Charles",
      last_name: "Gordon",
      msisdn: "61491570156",
      optout: false,
      delivery_status: "delivered"
    },
    {
      first_name: "Alex",
      last_name: "Fergle",
      msisdn: "61491570157",
      optout: true,
      delivery_status: "soft-bounce"
    }
  ]
}

XML Response

<?xmlversion="1.0"encoding="UTF-8"?>
<response>
  <page>
    <count>1</count>
    <number>1</number>
  </page>
  <total>2</total>
  <message>
    <message_id>565645</message_id>
    <send_at>2013-06-01 12:34:00</send_at>
    <recipients>2</recipients>
    <list>
      <id>123</id>
      <name>BFFs</name>
    </list>
  </message>
  <recipients>
    <first_name>Charles</first_name>
    <last_name>Gordon</last_name>
    <msisdn> 61491570156 </msisdn>
    <optout>false</optout>
    <delivery_status>delivered</delivery_status>
  </recipients>

  <recipients>
    <first_name>Alex</first_name>
    <last_name>Fergle</last_name>
    <msisdn>61491570157</msisdn>
    <optout>true</optout>
    <delivery_status>soft-bounce</delivery_status>
  </recipients>
</response>



Delivery Status



Description


deliveredMessage delivered to handset
pendingNo confirmation yet
soft-bounceHandset out of range or switched off
hard-bounceNumber disconnected


PHP Example


<?php
 include '../../APIClient2.php';

 $api = new transmitsmsAPI('API_KEY', 'API_SECRET');
 $offset = 0;
 $limit = 10;
 $result = $api->getSmsSent(49606, $offset, $limit);

 if ($result->error->code == 'SUCCESS') {
   echo "Message sent to {$result->total} recipients, showing page {$result->page->number}
     of {$result->page->count} <hr>";

   foreach ($result->recipients as $recipient) {
     echo "{$recipient->first_name} {$recipient->last_name} - {$recipient->delivery_status} <br>";
   }

 } else {
    echo "Error: {$result->error->description}";
 }