Pick up responses to messages you have sent. Filter by keyword or for just one phone number.


We created a new viewing experience for our SMS API documentation. It's now all in one central location. Click here to check it out!


Parameter

Description

Required

message_idMessage IDIf keyword_id not set
keyword_idKeyword IDIf message_id not set
keywordKeywordNO
numberFilter results by response numberIf keyword is set
msisdnFilter results by a particular mobile numberNO
pagePage number, for paginationNO
maxMaximum results returned per pageNO
include_originalinclude text of original messageNO


Example: Get SMS responses from a message send


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


Example: Get SMS responses from a keyword


curl https://api.transmitsms.com/get-sms-responses.json \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret \
  -d keyword=JOIN
  -d number=61491570156


Example: Get SMS responses from a particular user


curl https://api.transmitsms.com/get-sms-responses.json \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret \
  -d msisdn=61491570158


JSON Response

{
  page: {
    count: 3,
    number: 1
  },
  total: 5003,
  responses: [
    {
      id: 12345,
      list_id: 567,
      message_id: 4565,
      received_at: "2013-06-21 23:45:11",
      first_name: "Charles",
      last_name: "Gordon",
      msisdn: "61491570156",
      response: "23 Inspiring St, Fairlight"
    }
  ]
}

XML Response

<?xmlversion="1.0"encoding="UTF-8"?>
<response>
  <page>
    <count>3</count>
    <number>1</number>
  </page>
  <total>5003</total>
  <responses>
    <id>12345</id>
    <list_id>567</list_id>
    <message_id>4565</message_id>
    <received_at>2013-06-21 23:45:11</received_at>
    <first_name>Charles</first_name>
    <last_name>Gordon</last_name>
    <msisdn>61491570156</msisdn>
    <response>23 Inspiring St, Fairlight</response>
  </responses>
</response>


PHP Examples


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

 $api = new transmitsmsAPI('API_KEY', 'API_SECRET');

 // getting responses to message by ID 
 //$result = $api->getSmsResponses(49484);

 // getting responses by keyword ID
 //$result = $api->getSmsResponses(null, 91);

 // getting keyword responses by keyword and number
 $result = $api->getSmsResponses(null, null, 'cmon', '6140000000', '6140000001');

 if ($result->error->code == 'SUCCESS') {
   echo "There are {$result->total} responses, showing page 
     {$result->page->number} of {$result->page->count} <hr>";
     
   foreach ($result->responsesas$response) {
     echo "{$response->first_name}{$response->last_name} responded 
         '{$response->response}' at {$response->received_at}<br>";
   }

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