API to retrieve multiple SMS messages
Use the SMS Get Messages API to retrieve multiple SMS messages
The SMS Get Messages API is used to retrieve multiple SMS message sent to/from a specific DialogTech SMS enabled tracking number over a date range
Base URL for SMS Get Messages
Parameter List
Parameter | Required | Accepts | Max Length | Notes | Usage |
---|---|---|---|---|---|
action | Yes | String: sms.get_messages | n/a | Only accepts sms.get_messages to retrieve multiple SMS Messages | Defines the API Call as "SMS Get Messages" type |
access_key | Yes | String | n/a | Access Key from the Key Manager within a DialogTech account | Credentials used for access to the API for a particular DialogTech account |
secret_access_key | Yes | String | n/a | Secret Access Key from the Key Manager within a DialogTech account | Credentials used for access to the API for a particular DialogTech account |
start_date | Yes | Date | 8 | Date format should be YYYYMMDD | Defines the end of the date-range for records to be returned from |
end_date | Yes | Date | 8 | Date format should be YYYYMMDD | Defines the end of the date-range for records to be returned from |
number | No | String: Unformatted Phone Number | n/a | SMS enabled DialogTech tracking number | Filters the response to only include SMS records where the tracking number matches the number provided |
Using this API
These code examples are meant to show a basic method of accessing DialogTech's IVR Report API.
<?php
/*
SMS Send Message EX:
This example will send an SMS with
the text 'Thank you for calling.'
to a predefined number and echo the
verbatim XML response.
*/
// Create cURL resource
$ch = curl_init();
$baseuri = "https://secure.dialogtech.com/ibp_api.php?";
// API Specific Static Parameters
$action = "sms.get_messages";
// Required User Parameters To Request the API
$access_key = "foo";
$secret_access_key = "bar";
$start_date = "20170101";
$end_date = "20170101";
// Construct the full URL
$full_url = $baseuri . "&action=" . $action .
"&access_key=" . $access_key .
"&secret_access_key=" . $secret_access_key .
"&start_date=" . $start_date .
"&end_date=" . $end_date;
// Set the URL
curl_setopt($ch, CURLOPT_URL, $full_url);
// Sets the return options of the cURL to return the actual result from the curl request, and FALSE on failure
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Sets the $output variable to the result of the curl
$output = curl_exec($ch);
// Close curl resource to free up system resources
curl_close($ch);
// Echo the XML response to the page
echo $output;
?>
curl -X ""
Example Response
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE response [
<!ELEMENT response (result,result_description,data)>
<!ELEMENT result (#PCDATA)>
<!ELEMENT result_description (#PCDATA)>
<!ELEMENT data (messages)>
<!ELEMENT messages (inbound+,outbound+)>
<!ELEMENT inbound (message+)>
<!ELEMENT message (msg_id, to, from, message, date)>
<!ELEMENT msg_id (#PCDATA)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT message (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT outbound (message+)>
<!ELEMENT message (msg_id, to, from, message, date)>
<!ELEMENT msg_id (#PCDATA)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT message (#PCDATA)>
<!ELEMENT date (#PCDATA)>
]>
<response>
<result>success</result>
<result_description>[3] Message(s) Returned</result_description>
<messages>
<inbound>
<message>
<msg_id>177931295</msg_id>
<to>5554443210</to>
<from>5554443210</from>
<message><![CDATA[Hi. I'm looking for a product ID for a blue left-handed widget.]]></message>
<date>2017-01-01 09:30:00</date>
</message>
</inbound>
<outbound>
<message>
<msg_id>131086044</msg_id>
<to>5554443210</to>
<from>5554443210</from>
<message><![CDATA[Hi! Thanks for contacting us. We are looking pulling information now and we will send it shortly.]]></message>
<date>2017-01-01 09:30:01</date>
</message>
<message>
<msg_id>133185904</msg_id>
<to>5554443210</to>
<from>5554443210</from>
<message><![CDATA[Thanks again for taking my call. As we discussed, the product you're interested in is number 012345. Happy New Year!]]></message>
<date>2017-01-01 10:07:31</date>
</message>
</messages>
</response>