Sidebar Menu

AdvancedSMSSend

Immediately send or schedule a single text message to multiple phone numbers, or individual messages to multiple recipients. The AdvancedSMSSend method includes a [PostBackURL] parameter. SMS Notify! uses DIDs or short codes assigned to your account license key to send MT text messages and receive MO text messages.

Request Parameters

Parameter Name Data Type Sample Input
Concatenate: Flag to indicate if concatenation headers should be added to messages that were broken into fragments. (Not supported by all devices.). Boolean False
IsUnicode: Flag to indicate if message should be sent using Unicode encoding (UCS-2). Boolean False
LicenseKey: Required to authenticate users invoking this Web Service.

Trial Key. Production Key.

String F01d89fd-5155-5455-5585-e84ab8de8591
SMSRequests: An array of SMS Requests shown below.
SMSRequest

AssignedDID: Input the number of an assigned DID (Contact CDYNE to request an assigned DID).

Message: Message to send to phone number

PhoneNumbers: Input phone number to send SMS text to.

ReferenceID: A unique ID that can be set per SMS message.

ScheduledDateTime: Input desired UTC time to send the message.

StatusPostBackURL: Input to receive posts to your server when SMS has been sent, and when response is received.


String

String

Array (String)

String

Datetime

String


17575449510

This is a sample message from SMS Notify!

17575551234;17575554321

CDYNE Test

009-03-23T15:02:30.05Z

Server URL

Response

Parameter Name Data Type Sample Output
Cancelled: Returns true or false if the SMS message has been cancelled. Boolean False
MessageID: Returns unique Guid ID for every SMS message sent. Guid B01d89fd-5155-5455-5585-e84ab8de8591
Queued: Returns true or false if the SMS message has been queued. Boolean True
ReferenceID: Returns a unique ID that is assigned during request input. (Not a required Input) String CDYNE Test
SMSError: Returns a string indicating if there was an error sending the SMS message.
  • NoError
  • STOPfromPhoneNumber
  • LicenseKeyInvalid
  • PhoneNumberInvalid
  • MessageInvalid
  • ScheduledDateTimeIsNotUTC
  • InvalidAssignedDID
  • NotFound (Occurs for Invalid MessageID)
  • InternalError
  • ContactCdyneAccountSuspended
String NoError
SMSIncomingMessages: Returns null when part of a Send response. Null Null
Sent: Returns true or false if the SMS message has been sent to the carrier. Boolean False
SentDateTime: Returns the UTC Date and Time of when the message was sent. Datetime 0001-01-01T00:00:00

Code Samples



<SMSAdvancedRequest xmlns="http://schemas.datacontract.org/2004/07/SmsWS">
  <Concatenate>true</Concatenate>
  <IsUnicode>true</IsUnicode>   //Optional - If <IsUnicode>true</IsUnicode> max message character limit is 70.
  <LicenseKey>1627aea5-8e0a-4371-9022-9b504344e724</LicenseKey>
  <SMSRequests>
    <SMSRequest xmlns="http://sms2.cdyne.com">
      <AssignedDID>String content</AssignedDID>
      <Message>String content</Message>
      <PhoneNumbers>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String content</string>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String content</string>
      </PhoneNumbers>
      <ReferenceID>String content</ReferenceID>
      <ScheduledDateTime>1999-05-31T11:20:00</ScheduledDateTime>
      <StatusPostBackURL>String content</StatusPostBackURL>
    </SMSRequest>
    <SMSRequest xmlns="http://sms2.cdyne.com">
      <AssignedDID>String content</AssignedDID>
      <Message>String content</Message>
      <PhoneNumbers>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String content</string>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String content</string>
      </PhoneNumbers>
      <ReferenceID>String content</ReferenceID>
      <ScheduledDateTime>1999-05-31T11:20:00</ScheduledDateTime>
      <StatusPostBackURL>String content</StatusPostBackURL>
    </SMSRequest>
  </SMSRequests>
</SMSAdvancedRequest>


<ArrayOfSMSResponse xmlns="http://sms2.cdyne.com">
  <SMSResponse>
    <Cancelled>true</Cancelled>
    <MessageID>1627aea5-8e0a-4371-9022-9b504344e724</MessageID>
    <Queued>true</Queued>
    <ReferenceID>String content</ReferenceID>
    <SMSError>NoError</SMSError>
    <SMSIncomingMessages i:nil="true" />
    <Sent>true</Sent>
    <SentDateTime>1999-05-31T11:20:00</SentDateTime>
  </SMSResponse>
  <SMSResponse>
    <Cancelled>true</Cancelled>
    <MessageID>1627aea5-8e0a-4371-9022-9b504344e724</MessageID>
    <Queued>true</Queued>
    <ReferenceID>String content</ReferenceID>
    <SMSError>NoError</SMSError>
    <SMSIncomingMessages i:nil="true" />
    <Sent>true</Sent>
    <SentDateTime>1999-05-31T11:20:00</SentDateTime>
  </SMSResponse>
</ArrayOfSMSResponse>

 //Request parameters in JSON format
$json='{
                "Concatenate":"true",  //Optional.
                "IsUnicode":"true",  //Optional. If "IsUnicode":"true" max message character limit is 70.
                "LicenseKey":"LicenseKey",
                "SMSRequests":[{
		"AssignedDID":"",
		"Message":"Hello there",
		"PhoneNumbers":["PhoneNumber"],
		"ReferenceID":"",
		"ScheduledDateTime":"\/Date(1239018869048)\/",
		"StatusPostBackURL":""
                                                            }]
}';

//Method
$url='http://sms2.cdyne.com/sms.svc/AdvancedSMSsend';

$cURL = curl_init();
 
curl_setopt($cURL,CURLOPT_URL,$url);
curl_setopt($cURL,CURLOPT_POST,true);
curl_setopt($cURL,CURLOPT_POSTFIELDS,$json);
curl_setopt($cURL,CURLOPT_RETURNTRANSFER, true);  
curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: application/json'));
//If you desire your results in xml format, use the following line for your httpheaders and comment out the httpheaders code line above.
//curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); 
$result = curl_exec($cURL);
 
curl_close($cURL);

print_r($result)

</syntashighlight>

=== Ruby ===

<syntaxhighlight lang="ruby" line="line">
require 'uri'
require 'net/http'

url = URI("http://sms2.cdyne.com/sms.svc/AdvancedSMSSend")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)

request["content-type"] = 'application/json'

request.body = '{
"Concatenate": false,
"IsUnicode": false,
"LicenseKey":"F01d89fd-5155-5455-5585-e84ab8de8591",
"SMSRequests":[{
"AssignedDID":"",
"Message":"CDYNE test message.",
"PhoneNumbers":["17575449510"],
"ReferenceID":"123",
"StatusPostBackURL":"www.yourpostbackurlhere.com",
"ScheduledDateTime":"\/Date(928164000000)\/"}]
}'

response = http.request(request)

puts response.read_body
Dim thexml

'The xml may look sloppy, but it must be a single line to work.
'Look here http://sms2.cdyne.com/sms.svc/help/operations/AdvancedSMSsend for a sample xml packet in a more readable format.
'For this sample to work, replace all the (your value here) in thexml with the values you wish to use.

thexml = "<SMSAdvancedRequest xmlns=""http://schemas.datacontract.org/2004/07/SmsWS""> <Concatenate>true</Concatenate><IsUnicode>true</IsUnicode>
<LicenseKey>(Your License Key)</LicenseKey><SMSRequests><SMSRequest xmlns=""http://sms2.cdyne.com""><AssignedDID></AssignedDID><Message>(Your Message)</Message>
<PhoneNumbers><string xmlns=""http://schemas.microsoft.com/2003/10/Serialization/Arrays"">(Your Number</string></PhoneNumbers><ReferenceID></ReferenceID>
<StatusPostBackURL></StatusPostBackURL></SMSRequest></SMSRequests></SMSAdvancedRequest>"

'<ScheduledDateTime>1999-05-31T11:20:00</ScheduledDateTime>
'If you wish for the message to be sent at a future datetime include this parameter.
'Note the ScheduledDateTime must be in UTC format.

dim xmlHttp
 
set xmlHttp = createobject("Microsoft.XMLHTTP")
 
call xmlHttp.open("POST", "http://sms2.cdyne.com/sms.svc/AdvancedSMSsend",false) 
call xmlHttp.setRequestHeader("Content-Type","text/xml") 
call xmlHttp.send(thexml)

document.write(xmlHttp.responseText)
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;

public final class SMSNotifyAdvanced {
 public static void main(String[] args) throws Exception 
{
String responseContent="";
String response="";
                
URL url = new URL("http://sms2.cdyne.com/sms.svc/AdvancedSMSsend");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
		
StringBuilder sb = new StringBuilder("<SMSAdvancedRequest xmlns=\"http://schemas.datacontract.org/2004/07/SmsWS\">");
        sb.append("<Concatenate>true</Concatenate>");  //Optional.
        sb.append("<IsUnicode>true</IsUnicode>");  //Optional.  If sb.append("<IsUnicode>true</IsUnicode>") max message character limit is 70.
        sb.append("<LicenseKey>YOUR LICENSE KEY</LicenseKey>");
        sb.append("<SMSRequests>");
        sb.append("<SMSRequest xmlns=\"http://sms2.cdyne.com\">");
        sb.append("<AssignedDID>YOUR DID</AssignedDID>"); //OPTIONAL
        sb.append("<Message>Test Message</Message>"); 
        sb.append("<PhoneNumbers>");
        sb.append("<string xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">15551234567</string>");
        sb.append("<string xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">15551234567</string>");
        sb.append("</PhoneNumbers>");
        sb.append("<ReferenceID>1234</ReferenceID>");
        sb.append("<ScheduledDateTime>2013-01-15T20:53:00Z</ScheduledDateTime>");  
        sb.append("<StatusPostBackURL>http://www.postbackurl.com</StatusPostBackURL>"); //OPTIONAL
        sb.append("</SMSRequest>");
        sb.append("</SMSRequests>");
        sb.append("</SMSAdvancedRequest>");
		
connection.setRequestProperty("Content-Length", String.valueOf(sb.toString().length()));
connection.setRequestProperty("Content-Type", "text/xml");
connection.setRequestProperty("Connection", "Close");
connection.setRequestProperty("SoapAction", "");
connection.setDoOutput(true);
		
PrintWriter pw = new PrintWriter(connection.getOutputStream());
pw.write(sb.toString());
pw.flush();
		
connection.connect();

BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
 
while ((responseContent = in.readLine()) != null)
{
response += responseContent;
}
System.out.println(response);
    }    
}