Query Status & Replies

Base URI

https://secure.telemessage.com

Endpoint

POST /partners/xmlMessage.jsp
Query status and replies for messages sent via TeleMessage service. 

You can pull status of message by sending the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<TELEMESSAGE>
    <TELEMESSAGE_CONTENT>
        <MESSAGE_STATUS_QUERY>
            <MESSAGE_ID>102030</MESSAGE_ID>
            <MESSAGE_KEY>102030</MESSAGE_KEY>
        </MESSAGE_STATUS_QUERY>
    </TELEMESSAGE_CONTENT>
    <VERSION>1.3</VERSION>
</TELEMESSAGE>

Or in case you want to query replies, simply, add <SHOW_REPLIES>true</SHOW_REPLIES>

<?xml version="1.0" encoding="UTF-8"?>
<TELEMESSAGE>
     <TELEMESSAGE_CONTENT>
          <MESSAGE_STATUS_QUERY>
               <MESSAGE_ID>2151375</MESSAGE_ID>
               <MESSAGE_KEY>10021016319846517266385885</MESSAGE_KEY>
               <SHOW_REPLIES>true</SHOW_REPLIES>
          </MESSAGE_STATUS_QUERY>
     </TELEMESSAGE_CONTENT>
     <VERSION>1.6</VERSION>
</TELEMESSAGE>
<?xml version="1.0" encoding="UTF-8"?>
<TELEMESSAGE>
  <TELEMESSAGE_CONTENT>
    <MESSAGE_STATUS>
      <STATUS_ID>2501</STATUS_ID>
      <STATUS_DESCRIPTION>SMS was delivered to handset</STATUS_DESCRIPTION>
      <MESSAGE_ID>352484528</MESSAGE_ID>
      <RECIPIENT_STATUS>
        <RECIPIENT_NAME>1-xxx-xxxxxxx</RECIPIENT_NAME>
        <DEVICE>
          <TYPE>60</TYPE>
          <VALUE>1-xxx-xxxxxx</VALUE>
          <STATUS>2501</STATUS>
          <DESCRIPTION>SMS was delivered to handset</DESCRIPTION>
          <STATUS_DATE>20141027 13:24:55</STATUS_DATE>
        </DEVICE>
      </RECIPIENT_STATUS>
    </MESSAGE_STATUS>
  </TELEMESSAGE_CONTENT>
  <VERSION>1</VERSION>
</TELEMESSAGE>
<TELEMESSAGE>
    <TELEMESSAGE_CONTENT>
        <MESSAGE_STATUS>
            <STATUS_ID>2401</STATUS_ID>
            <STATUS_DESCRIPTION>Call was answered</STATUS_DESCRIPTION>
            <MESSAGE_ID>1460051</MESSAGE_ID>
            <RECIPIENT_STATUS>
                <RECIPIENT_NAME>1-xxx-xxxxxx</RECIPIENT_NAME>
                <DEVICE>
                    <TYPE>10</TYPE>
                    <VALUE>1-xxx-xxxxxx</VALUE>
                    <STATUS>2401</STATUS>
                    <DESCRIPTION>Call was answered</DESCRIPTION>
                    <STATUS_DATE>20130421 11:35:53</STATUS_DATE>
                    <ANSWER>1</ANSWER>
                </DEVICE>
            </RECIPIENT_STATUS>
            <RECIPIENT_STATUS>
                <RECIPIENT_NAME>1-yyy-yyyyyyy</RECIPIENT_NAME>
                <DEVICE>
                    <TYPE>10</TYPE>
                    <VALUE>1-yyy-yyyyyyy</VALUE>
                    <STATUS>2401</STATUS>
                    <DESCRIPTION>Call was answered</DESCRIPTION>
                    <STATUS_DATE>20130421 11:35:56</STATUS_DATE>
                    <ANSWER>1</ANSWER>
                </DEVICE>
            </RECIPIENT_STATUS>
        </MESSAGE_STATUS>
    </TELEMESSAGE_CONTENT>
    <VERSION>1</VERSION>
</TELEMESSAGE>

You can test your XML code here or track message delivery status here

 

Explore additional code samples & developer resources: 

JAVA LibraryPHP LibraryREST APISOAP APIHTTP API, and more

import java.io.*;
import java.io.FileInputStream;
import javax.mail.internet.MimeUtility;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
import org.apache.commons.httpclient.methods.PostMethod;


 	public static void main(String[] args) {
 	try {
 		// Get target URL
String strURL = "https://secure.telemessage.com/partners/xmlMessage.jsp";
InputStream xmlin =null;

*//Send xml file (read a local xml file and send it)
String strXMLFilename = "add your file path here" ;
File input = new File(strXMLFilename);
xmlin = new FileInputStream(input);

//Prepare HTTP post
PostMethod post = new PostMethod(strURL);

//Request content will be retrieved directly 
/// from the input stream
post.setRequestBody(xmlin);

//Per default, the request content needs to be buffered
// in order to determine its length.
// Request body buffering can be avoided when
// = content length is explicitly specified
// = chunk-encoding is used
if (input.length() < Integer.MAX_VALUE) {
post.setRequestContentLength((int)input.length());
} else {
post.setRequestContentLength(EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED);
}

//Specify content type and encoding
// If content encoding is not explicitly specified
// ISO-8859-1 is assumed
post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");

//Get HTTP client
HttpClient httpclient = new HttpClient();

//Execute request
int result = httpclient.executeMethod(post);

//Display status code
System.out.println("Response status code: " + result);

//Display response
String responseStr = post.getResponseBodyAsString();
System.out.println("Response body: ");
System.out.println(responseStr);

//Release current connection to the connection pool once you are done
post.releaseConnection();
 	
 } catch (Exception e) {
 	 System.out.println(e.getMessage()); 
       }
}
Sub main()

 Dim objHTTP As New MSXML.XMLHTTPRequest
 Dim strMessage As String
 Dim strReturn As String
 Dim objReturn As New MSXML.DOMDocument

 'Create the string to send
 strMessage = "enter your XML message here" (see XML templates)

 'Set up to post to our server
 objHTTP.open("post", "https://secure.telemessage.com/partners/xmlMessage.jsp", False)

 'Set a standard XML header for the content-type
 objHTTP.setRequestHeader("Content-Type", "text/xml")

 'Send the message
 objHTTP.send(strMessage)

 'Get the return response
 strReturn = objHTTP.responseText

 'Load the return response into a DOM
 objReturn.loadXML(strReturn)

 'Write the return response
 Console.WriteLine(strReturn)

End Sub 
$xmlstring = "<?xml........"; 

    //creating header for http post request
    $myHeader = array(
        "MIME-Version: 1.0",
        "Content-type: text/xml; charset=utf-8"
    );
    //creating and initiating curl
    $ch = curl_init();
    //setting curl/http headers
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlstring);
    curl_setopt($ch, CURLOPT_URL, " https://secure.telemessage.com/partners/xmlMessage.jsp ");
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $myHeader);
    //executing http request and getting response. $postResult will contain response xml from TeleMessage.
    $postResult = curl_exec($ch);
    if (curl_errno($ch)) {
        return null;
        /*
        * for PHP5 you can throw Exception:
        * throw new Exception("Error while sending");
        */
    }
    curl_close($ch);

    return $postResult;
}
public void sendMessage()
{

MSXML.XMLHTTPRequestobjHTTP = new MSXML.XMLHTTPRequest();
stringstrMessage = null;
stringstrReturn = null;
MSXML.DOMDocumentobjReturn = new MSXML.DOMDocument();

//Create the string to send
strMessage = "enter your XML message here" (see XML templates);

//Set up to post to our server
objHTTP.open("post",
"https://secure.telemessage.com/partners/xmlMessage.jsp", false);

//Set a standard XML header for the content-type
objHTTP.setRequestHeader("Content-Type", "text/xml");

//Send the message
objHTTP.send(strMessage);

//Get the return response
strReturn = objHTTP.responseText;

//Load the return response into a DOM
objReturn.loadXML(strReturn);

//Write the return response
Console.WriteLine(strReturn);