Sidebar Menu

GetMessageStatus

This method reads the status of an incoming or outgoing message. This method is deprecated: use ReadMessageStatus instead.

Endpoint

GET:
https://messaging.esendex.us/messaging.svc/GetMessageStatus?MessageID={MESSAGEID}

POST:
https://messaging.esendex.us/messaging.svc/GetMessageStatus

Syntax

GetMessageStatus(MessageId)

Request Parameters

Parameter Name Description Data Type Required Sample Value
MessageID

Unique ID of the message.

GUID True 1627aea5-8e0a-4371-9022-9b504344e724

Response

Returns: SMSResponse object

Code Samples

You can use any programming language you want with our API, as long as it can make a REST or SOAP call. Here are examples for some of the most common platforms.

// https://messaging.esendex.us/Messaging.svc?wsdl was added as a Service Reference and given the name WSDL

using WSDL;

var client = new MessagingClient(MessagingClient.EndpointConfiguration.mms2wsHttpBindingSecure);

// Let's send a message.
var response = await client.SimpleSMSsendAsync(YOUR_TO_NUMBER, "Hello.", YOUR_LICENSE_KEY);

// We can use this ID to fetch the message's status later on.
var messageId = response.MessageID;

if (messageId == Guid.Empty)
{
    Console.WriteLine("The message could not be sent.");
    return;
}

// We can fetch the message's status at any time. Let's do it now.
var message = await client.GetMessageStatusAsync(messageId);

Console.WriteLine(
    "Message ID: " + message.MessageID + Environment.NewLine +
    "Error: " + message.SMSError);
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

public final class GetMessageStatus{
    public static void main(String[] args) {
        try {
            URL url = new URL("https://messaging.esendex.us/Messaging.svc/GetMessageStatus?"
                        + "MessageID=YOUR MESSAGEID");

            try {
                InputStream in = url.openStream();
                StreamSource source = new StreamSource(in);
                printResult(source);
            } catch (java.io.IOException e) {
                e.printStackTrace();
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }

    private static void printResult(Source source) {
        try {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            StreamResult sr = new StreamResult(bos);
            Transformer trans = TransformerFactory.newInstance().newTransformer();
            Properties oprops = new Properties();
            oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
            trans.setOutputProperties(oprops);
            trans.transform(source, sr);
            System.out.println("**** Response ******");
            System.out.println(bos.toString());

            bos.close();
            System.out.println();
        } catch (Exception e) {
        }
    }
}
<?php

// Returns the status of a single SMS message using the Message ID from the SMSResponse object.


$client = new SoapClient('https://messaging.esendex.us/Messaging.svc?wsdl');

$param = array(
  'MessageID' => '(your message ID here)' // MessageID from SMSResponse Object
);

$result = $client->GetMessageStatus($param);

print_r($result);

?>
<?php

// Returns the status of a single SMS message using the Message ID from the SMSResponse object.


$url = 'https://messaging.esendex.us/Messaging.svc/GetMessageStatus?MessageID=(MESSAGE ID HERE)';
$cURL = curl_init();

curl_setopt($cURL, CURLOPT_URL, $url);
curl_setopt($cURL, CURLOPT_HTTPGET, true);
curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));

$result = curl_exec($cURL);
curl_close($cURL);

print_r($result);

?>
"1627aea5-8e0a-4371-9022-9b504344e724"
{
	"Cancelled": true,
	"MessageID": "1627aea5-8e0a-4371-9022-9b504344e724",
	"Queued": true,
	"ReferenceID": "String content",
	"SMSError": 0,
	"SMSIncomingMessages": [
		{
			"FromPhoneNumber": "String content",
			"IncomingMessageID": "1627aea5-8e0a-4371-9022-9b504344e724",
			"MatchedMessageID": "1627aea5-8e0a-4371-9022-9b504344e724",
			"Message": "String content",
			"ResponseReceiveDate": "\/Date(928164000000-0400)\/",
			"ToPhoneNumber": "String content"
		}
	],
	"Sent": true,
	"SentDateTime": "\/Date(928164000000-0400)\/"
}
<guid xmlns="http://schemas.microsoft.com/2003/10/Serialization/">1627aea5-8e0a-4371-9022-9b504344e724</guid>
<SMSResponse xmlns="http://sms2.cdyne.com">
  <Cancelled>true</Cancelled>
  <MessageID>1627aea5-8e0a-4371-9022-9b504344e724</MessageID>
  <Queued>true</Queued>
  <ReferenceID>String content</ReferenceID>
  <SMSError>NoError</SMSError>
  <SMSIncomingMessages>
    <SMSIncomingMessage>
      <FromPhoneNumber>String content</FromPhoneNumber>
      <IncomingMessageID>1627aea5-8e0a-4371-9022-9b504344e724</IncomingMessageID>
      <MatchedMessageID>1627aea5-8e0a-4371-9022-9b504344e724</MatchedMessageID>
      <Message>String content</Message>
      <ResponseReceiveDate>1999-05-31T11:20:00</ResponseReceiveDate>
      <ToPhoneNumber>String content</ToPhoneNumber>
    </SMSIncomingMessage>
    <SMSIncomingMessage>
      <FromPhoneNumber>String content</FromPhoneNumber>
      <IncomingMessageID>1627aea5-8e0a-4371-9022-9b504344e724</IncomingMessageID>
      <MatchedMessageID>1627aea5-8e0a-4371-9022-9b504344e724</MatchedMessageID>
      <Message>String content</Message>
      <ResponseReceiveDate>1999-05-31T11:20:00</ResponseReceiveDate>
      <ToPhoneNumber>String content</ToPhoneNumber>
    </SMSIncomingMessage>
  </SMSIncomingMessages>
  <Sent>true</Sent>
  <SentDateTime>1999-05-31T11:20:00</SentDateTime>
</SMSResponse>