GetUnreadIncomingMessages

From CDYNE Wiki
Jump to: navigation, search

This method returns all unread text message responses attached to a single License Key and marks them as read.

Contents

GetUnreadIncomingMessages Request

Parameter Name Data Type Sample Input
LicenseKey: Required to authenticate users invoking this Web Service.

Trial Key. Production Key.

String F01d89fd-5155-5455-5585-e84ab8de8591

HTTP Method

HTTP Method: GET

Url: http://sms2.cdyne.com/sms.svc/GetUnreadIncomingMessages?LicenseKey={LICENSEKEY}

Url: https://sms2.cdyne.com/sms.svc/GetUnreadIncomingMessages?LicenseKey={LICENSEKEY}

GetUnreadIncomingMessages Response

Parameter Name Data Type Sample Output
FromPhoneNumber: Returns the phone number that sent the incoming message. String 15551235678
IncomingMessageID: Returns a unique ID that is assigned to every incoming message received.

This is different than original MessageID.

Guid A01d89fd-5155-5455-5585-e84ab8de8591
MatchedMessageID: Returns the unique ID that was assigned to the original SMS message sent. Guid B01d89fd-5155-5455-5585-e84ab8de8591
Message: Returns a string of the incoming message sent. String Hi, Thanks for the message.
ResponseReceivedDate: Returns the date and time of when the response was received. Datetime 2010-05-11T19:17:28
ToPhoneNumber: Returns the phone number used to send the original SMS message sent. String 15551233325

XML Response

The following is an example response Xml body:


<ArrayOfSMSIncomingMessage xmlns="http://sms2.cdyne.com">
  <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>
</ArrayOfSMSIncomingMessage>

Json Response

The following is an example response Json body:


[{
	"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"
}]

GetUnreadIncomingMessages Code Examples

C#

IsmsClient client = new IsmsClient("sms2wsHttpBinding");
Array IncomingList = client.GetUnreadIncomingMessages(new Guid("YOUR LICENSE KEY"));
if (IncomingList.Length > 0)
{
foreach (WSDL.SMSIncomingMessage Message in IncomingList)
Console.WriteLine(Message.IncomingMessageID + " " + Message.FromPhoneNumber + " " + Message.Message + " " + Message.ResponseReceiveDate.ToString());
}
Console.ReadLine();
client.Close();

VB.NET

Imports GetUnreadIncomingMessages.WSDL
Module Module1
Sub Main()
Dim client As New GetUnreadIncomingMessages.WSDL.IsmsClient("sms2wsHttpBinding")
Dim resp As GetUnreadIncomingMessages.WSDL.SMSIncomingMessage() = client.GetUnreadIncomingMessages(New Guid("YOUR LICENSE KEY"))
For Each item In resp
Console.WriteLine(Convert.ToString(item.FromPhoneNumber) & " " & Convert.ToString(item.Message) & " " & Convert.ToStrin(item.IncomingMessageID) & " " & Convert.ToString(item.ResponseReceiveDate))
Next
Console.ReadLine()
client.Close()
End Sub
End Module

PHP

 
 
$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');
 
$param = array('LicenseKey' => '(your license key)');
 
$result = $client->GetUnreadIncomingMessages($param);
 
print_r($result);
 
 

PHP with cURL

 
 
$url='http://sms2.cdyne.com/sms.svc/GetUnreadIncomingMessages?LicenseKey=(License Key)';
 
$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);
 

VBScript

Dim oXMLHTTP
Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
Set oXMLHttp = CreateObject("Microsoft.XMLHTTP")
Set oDoc = CreateObject("MSXML2.DOMDocument")
Call oXMLHttp.Open("GET", "http://sms2.cdyne.com/sms.svc/GetUnreadIncomingMessages?LicenseKey=YOUR LICENSE KEY", False)
Call oXMLHttp.setRequestHeader("Content-Type", "text/xml")
Call oXMLHTTP.send
MsgBox oXMLHTTP.responseText

Ruby

require 'net/http'
require 'URI'
puts URI.methods
url = URI.parse('http://sms2.cdyne.com/sms.svc/GetUnreadIncomingMessages?LicenseKey=YOUR LICENSE KEY')
res = Net::HTTP.get_response(url)
data = res.body
puts data
gets data

JAVA

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 GetUnreadIncomingMessages{
public static void main(String[] args) {
 
try{
URL url = new URL("http://sms2.cdyne.com/sms.svc/GetUnreadIncomingMessages?"
+ "LicenseKey=YOUR LICENSE KEY");
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) {
}
}
}
Personal tools
Namespaces

Variants
Actions
Navigation
Tools

Trial Key