Sidebar Menu

GetMessageStatus

The GetMessageStatus method uses the MessageID parameter to return the status of a message (sent, queued, or error description).

Endpoint

GET (HTTP): https://sms2.cdyne.com/sms.svc/GetMessageStatus?MessageID={MESSAGEID}

Syntax

GetMessageStatus(MessageId)

Request Parameters

Parameter Name Description Data Type Required Sample Value
MessageID

Input unique Guid ID that is returned with every SMS message sent.

GUID True B01d89fd-5155-5455-5585-e84ab8de8591

Response

Returns: GetMessageStatusResponse object

Code Samples

// Add this service reference to http://sms2.cdyne.com/sms.svc?wsdl




// Example 1: Get Message Status
namespace GetMessageStatus
{
    class Program
    {
        static void Main(string[] args)
        {
            WSDL.IsmsClient client = new WSDL.IsmsClient("sms2wsHttpBinding");
            WSDL.SMSResponse resp = client.GetMessageStatus(new Guid("MESSAGE ID HERE"));

            Console.WriteLine(resp.SentDateTime + " " + resp.SMSError );
            Console.ReadLine();
            client.Close();
        }
    }
}




// Example 2: Send Message Then Get Message Status
namespace GetMessageStatus
{
    class Program
    {
        static void Main(string[] args)
        {
            IsmsClient client = new IsmsClient("sms2wsHttpBinding");
            SMSResponse resp = client.SimpleSMSsend("17575449510", "CDYNE Test Message", new Guid("YOUR LICENSE KEY"));
            DateTime sentTime = DateTime.Now;
            TimeSpan span = DateTime.Now - sentTime;

            while (!sent && span.TotalSeconds < 5)
            {
                Thread.Sleep(5000);
                resp = client.GetMessageStatus(resp.MessageID);
                sent = resp.Sent;
                span = DateTime.Now - sentTime;
            }

            Console.WriteLine("Message Sent: " + resp.Sent + "\n" + "Error: " + resp.SMSError + "\n" + "Message ID: " + resp.MessageID);
            Console.ReadLine();
            client.Close();
        }
    }
}
' Add a service reference to http://sms2.cdyne.com/sms.svc?wsdl




' Example 1: Get Message Status

Imports GetMessageStatus.WSDL
Module Module1
    Sub Main()
        Dim client As New GetMessageStatus.WSDL.IsmsClient("sms2wsHttpBinding")
        Dim resp As GetMessageStatus.WSDL.SMSResponse = client.GetMessageStatus(New Guid("MESSAGE ID HERE"))
        Console.WriteLine(resp.SentDateTime & " " & resp.SMSError)
        Console.ReadLine()
        client.Close()
    End Sub
End Module




' Example 2: Send Message Then Get Message Status

Imports VBapp.SMS
Module Module1
    Dim WithEvents T As System.Timers.Timer = New System.Timers.Timer(5000)
    Dim messageID As Guid
    Dim client As IsmsClient = New IsmsClient("sms2wsHttpBinding")

    Sub Main()
        Dim res As SMS.SMSResponse = client.SimpleSMSsend("7575449510", "Hi Tom", Guid.Empty)
        messageID = res.MessageID
        T.Start()
        Console.ReadLine()
    End Sub

    Private Sub ttick(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles T.Elapsed
        Console.WriteLine("Tick")
        Dim resp As SMS.SMSResponse = client.GetMessageStatus(messageID)
        If resp.SMSIncomingMessages.Length > 0 Then
            Console.WriteLine(resp.SMSIncomingMessages(0).Message)
            T.Stop()
            Console.WriteLine("Timer Close")
        End If
    End Sub
End Module
Dim oXMLHTTP
Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
Set oDoc = CreateObject("MSXML2.DOMDocument")

Call oXMLHttp.Open("GET", "http://sms2.cdyne.com/sms.svc/GetMessageStatus?MessageID=MESSAGE ID HERE", False)
Call oXMLHttp.setRequestHeader("Content-Type", "text/xml")
Call oXMLHTTP.send

MsgBox oXMLHTTP.responseText
<?php

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


$client = new SoapClient('http://sms2.cdyne.com/sms.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 = 'http://sms2.cdyne.com/sms.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);

?>
require 'net/http'
require 'URI'

puts URI.methods
url = URI.parse('http://sms2.cdyne.com/sms.svc/GetMessageStatus?MessageID=MESSAGE ID HERE')
res = Net::HTTP.get_response(url)
data = res.body

puts data
gets data
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("http://sms2.cdyne.com/sms.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) {
        }
    }
}
{
  "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)\/"
}
<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>2020-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>2020-05-31T11:20:00</ResponseReceiveDate>
      <ToPhoneNumber>String content</ToPhoneNumber>
    </SMSIncomingMessage>
  </SMSIncomingMessages>
  <Sent>true</Sent>
  <SentDateTime>2020-05-31T11:20:00</SentDateTime>
</SMSResponse>