API to retrieve a single SMS message
Use the SMS Get Message API to retrieve a single SMS message
The SMS Get Message API is used to retrieve a single SMS message sent to/from a DialogTech SMS enabled tracking number when the message ID is known.
Base URL for SMS Get Message
Parameter List
Parameter | Required | Accepts | Max Length | Notes | Usage |
---|---|---|---|---|---|
action | Yes | String: sms.get_message | n/a | Only accepts sms.get_message to retrieve an SMS Message | Defines the API Call as "SMS Get Message" 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 |
msg_id | Yes | Message ID | n/a | Message ID of a previously sent/received SMS message | Filters the response to only include SMS records where the message ID matches the msg_id provided |
Using this API
These code examples are meant to show a basic method of accessing DialogTech's IVR Report API.
<?php
/*
SMS Get Message EX:
This example will retrieve a
single SMS message with ID
133185904.
*/
// Create cURL resource
$ch = curl_init();
$baseuri = "https://secure.dialogtech.com/ibp_api.php?";
// API Specific Static Parameters
$action = "sms.get_message";
// Required User Parameters To Request the API
$access_key = "foo";
$secret_access_key = "bar";
$msg_id = "133185904";
// Construct the full URL
$full_url = $baseuri . "&action=" . $action .
"&access_key=" . $access_key .
"&secret_access_key=" . $secret_access_key .
"&msg_id=" . $msg_id;
// 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;
?>
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 (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>[1] Message(s) Returned</result_description>
<data>
<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>
</data>
</response>