Read incoming messages - you can view new or all incoming messages.
Parameter Name |
Data Type |
Sample Input |
Required |
---|---|---|---|
EndDate: UTC date and time of most recent incoming message. |
DateTime |
1999-05-31T11:20:00 |
FALSE |
IncomingMessageID: Unique ID assigned to incoming message. |
GUID |
1627aea5-8e0a-4371-9022-9b504344e724 |
FALSE |
LicenseKey: License key used to receive incoming message |
GUID |
f01d89fd-5155-5455-5585-e84ab8de8591 |
TRUE |
OutgoingMessageID: Unique ID of outgoing message. |
GUID |
1627aea5-8e0a-4371-9022-9b504344e724 |
FALSE |
PageNumber: Number of page where incoming message is located. |
Int |
0 |
FALSE |
PageSize: Number of incoming messages shown on page. |
Int |
0 |
FALSE |
ReferenceID: Unique ID that can be set. |
String |
123 |
FALSE |
StartDate: UTC date and time of earliest incoming message received. |
DateTime |
1999-05-31T11:20:00 |
FALSE |
UnreadMessagesOnly: You can choose to view all incoming messages or only incoming messages that are unread. |
Boolean |
false |
FALSE |
Parameter Name | Data Type | Sample Output |
---|---|---|
Attachment: MediaID of attachment sent in message. | String | 12486 |
From: DID/short code used to send message. | String | 15559080983 |
IncomingMessageID: Unique ID assigned to incoming message. | GUID | 1627aea5-8e0a-4371-9022-9b504344e724 |
OutgoingMessageID: Unique ID assigned to outgoing message. | GUID | 1627aea5-8e0a-4371-9022-9b504344e724 |
Payload: Incoming message content. | String | Thank you for your message |
ReceivedDate: UTC date and time incoming message was received. | DateTime | 1999-05-31T11:20:00 |
Subject: Subject of incoming message. | String | Reply |
| To: Recipient number. | String | 15551234567 |-
| Udh: Header that shows number of concatenated messages in correct
order. | Int | 81,109,70,122,90,83,65,50,78,67,66,84,100 |- |}
The following is an example POST request using
http://messaging.cdyne.com/Messaging.svc/ReadIncomingMessages
{
"EndDate":"\/Date(1506973090870+0000)\/",
"LicenseKey":"f01d89fd-5155-5455-5585-e84ab8de8591",
"PageNumber": 0,
"PageSize": 0,
"ReferenceID": "",
"StartDate":"\/Date(1506973090870+0000)\/",
"UnreadMessagesOnly":false
}
require 'uri'
require 'net/http'
url = URI("http://messaging.cdyne.com/Messaging.svc/ReadIncomingMessages")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = '{
"EndDate":"\/Date(1506973090870+0000)\/",
"LicenseKey":"f01d89fd-5155-5455-5585-e84ab8de8591",
"PageNumber": 0,
"PageSize": 0,
"ReferenceID": "",
"StartDate": "\/Date(1506973090870+0000)\/",
"UnreadMessagesOnly": false}'
response = http.request(request)
puts response.read_body
gets response.read_body
<code type=>
/*http://messaging.cdyne.com/Messaging.svc?wsdl was added as Service
Reference and given the name WSDL*/
using System; using System.Collections.Generic; using System.Linq; using
System.Text; using System.Threading.Tasks; using
ReadIncomingMessages.WSDL;
namespace ReadIncomingMessages {
class Program
{
static void Main(string[] args)
{
MessagingClient client = new MessagingClient("mms2wsHttpBinding");
IncomingMessageCriteria incoming = new IncomingMessageCriteria();
incoming.EndDate = new DateTime(2017, 10, 06, 17, 00, 0).ToUniversalTime();
incoming.IncomingMessageID = new Guid();
incoming.LicenseKey = new Guid("f01d89fd-5155-5455-5585-e84ab8de8591");
incoming.OutgoingMessageID = new Guid();
incoming.PageNumber = 0;
incoming.PageSize = 0;
incoming.ReferenceID = "";
incoming.StartDate = new DateTime(1990, 10, 01, 14, 15, 0).ToUniversalTime();
incoming.UnreadMessagesOnly = false;
IncomingMessageResponse[] resp = client.ReadIncomingMessages(incoming);
if (resp.Length > 0)
{
foreach (var item in resp)
{
Console.WriteLine("Incoming MessageID: " + item.IncomingMessageID + Environment.NewLine +
"Outgoing MessageID: " + item.OutgoingMessageID + Environment.NewLine +
"To: " + item.To + Environment.NewLine +
"From: " + item.From + Environment.NewLine +
"UTC Time Received: " + item.ReceivedDate + Environment.NewLine +
"Message Subject: " + item.Subject + Environment.NewLine +
"Message Text: " + item.Payload);
if (item.Attachments != null)
{
foreach (var media in item.Attachments)
{
Console.WriteLine("Attachments: " + media);
}
}
else Console.WriteLine("Attachments: No media.");
Console.WriteLine("UDH Info: " + item.Udh);
}
}
Console.ReadLine();
}
}
}
<code type=>
'http://messaging.cdyne.com/Messaging.svc?wsdl was added as Service
Reference and given the name WSDL
Imports ReadIncomingMessages.WSDL
Module Module1
Sub Main()
Dim client As WSDL.MessagingClient = New MessagingClient("mms2wsHttpBinding")
Dim req As New WSDL.IncomingMessageCriteria()
req.EndDate = New DateTime(2017, 10, 6, 17, 0, 0).ToUniversalTime()
req.IncomingMessageID = New Guid()
req.LicenseKey = New Guid("f01d89fd-5155-5455-5585-e84ab8de8591")
req.OutgoingMessageID = New Guid()
req.PageNumber = 0
req.PageSize = 0
req.ReferenceID = ""
req.StartDate = New DateTime(1990, 10, 1, 14, 15, 0).ToUniversalTime()
req.UnreadMessagesOnly = False
Dim resp As IncomingMessageResponse() = client.ReadIncomingMessages(req)
If resp.Length > 0 Then
For Each item In resp
Console.WriteLine("Incoming MessageID: " + Convert.ToString(item.IncomingMessageID) + Environment.NewLine +
"Outgoing MessageID: " + Convert.ToString(item.OutgoingMessageID) + Environment.NewLine +
"To: " + item.To + Environment.NewLine +
"From: " + item.From + Environment.NewLine +
"UTC Time Received: " + Convert.ToString(item.ReceivedDate) + Environment.NewLine +
"Message Subject: " + item.Subject + Environment.NewLine +
"Message Text: " + item.Payload + Environment.NewLine +
"UDH Info: " + Convert.ToString(item.Udh))
If item.Attachments IsNot Nothing Then
For Each attach In item.Attachments
Console.WriteLine("Attachments: " + Convert.ToString(attach))
Next
Console.WriteLine()
Else Console.WriteLine("Attachments: No media.")
Console.WriteLine()
End If
Next
End If
Console.ReadLine()
End Sub
End Module
<code type=>
<code type=>
Dim cXML cXML = "<IncomingMessageCriteria
xmlns=""http://sms2.cdyne.com"">" & _
"
2017-10-31T11:20:00
" & _
"
f01d89fd-5155-5455-5585-e84ab8de8591
" & _
"
2017-10-01T11:20:00
" & _
"
false
" & _
"
"
Dim oXMLHTTP Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP") Set oDoc =
CreateObject("MSXML2.DOMDocument") Call oXMLHttp.Open("POST",
"http://messaging.cdyne.com/Messaging.svc/ReadIncomingMessages",
False) Call oXMLHttp.setRequestHeader("Content-Type", "text/xml") Call
oXMLHttp.send(cXML)
MsgBox oXMLHTTP.responseText
Const ForReading = 1, ForWriting = 2, ForAppending = 8 Const
TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Dim fso,
MyFile, FileName, TextLine Set fso =
CreateObject("Scripting.FileSystemObject") FileName =
"c:\Users\Desktop\MMS.txt" Set MyFile = fso.OpenTextFile(FileName,
ForWriting, True) MyFile.WriteLine oXMLHttp.responseText MyFile.Close
Set MyFile = fso.OpenTextFile(FileName, ForReading) Do While
MyFile.AtEndOfStream <> True TextLine = MyFile.ReadLine Loop
MyFile.Close
set request = nothing
<code type=>
import java.io.BufferedReader; import java.io.InputStreamReader; import
java.io.PrintWriter; import java.net.HttpURLConnection; import
java.net.URL;
public final class ReadIncomingMessages {
public static void main(String[] args) throws Exception {
String responseContent = "";
String response = "";
URL url = new URL("
http://messaging.cdyne.com/Messaging.svc/ReadIncomingMessages
");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
StringBuilder sb = new StringBuilder("
<IncomingMessageCriteria xmlns="http://sms2.cdyne.com">");
sb.append("
2017-10-31T11:20:00
");
sb.append("
f01d89fd-5155-5455-5585-e84ab8de8591
");
sb.append("
2017-10-01T11:20:00
");
sb.append("
false
");
sb.append("
");
connection.setRequestProperty("Content-Length", String.valueOf(sb.toString().length()));
connection.setRequestProperty("Content-Type", "text/xml");
connection.setRequestProperty("Connection", "Close");
connection.setRequestProperty("SoapAction", "");
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
PrintWriter pw = new PrintWriter(connection.getOutputStream());
pw.write(sb.toString());
pw.flush();
connection.connect();
System.out.println(sb.toString());
BufferedReader br;
if (connection.getResponseCode() == 200) {
br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
} else {
br = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
}
while ((responseContent = br.readLine()) != null) {
response += responseContent;
}
System.out.println(response);
}
}