AdvancedSMSsend
This method sends one or more SMS messages to any number of recipients. This method is deprecated: use SendMessage
instead.
Endpoint
POST:https://messaging.esendex.us/Messaging.svc/AdvancedSMSsend
Syntax
AdvancedSMSsend(Request)
Request Parameters
Parameter Name | Description | Data Type | Required | Sample Value |
---|---|---|---|---|
Concatenate |
Whether concatenation headers should be added to messages that were broken into fragments. (This is not supported by all devices.) |
Boolean
|
False | True |
IsUnicode |
Whether the message should be sent using Unicode encoding (UCS-2). If true, the max message character count is 70. |
Boolean
|
False | True |
LicenseKey |
Your license key. |
String
|
True | 00000000-0000-0000-0000-000000000000 |
SMSRequests |
One or more SMS requests. |
Array of SMSRequest objects
|
True |
Response
Returns: Array of SMSResponse
objects
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);
var request = new SMSAdvancedRequest
{
LicenseKey = YOUR_LICENSE_KEY,
SMSRequests = new SMSRequest[] {
new SMSRequest {
AssignedDID = YOUR_FROM_NUMBER,
Message = "This is a test message.",
PhoneNumbers = new string[] { YOUR_TO_NUMBER }
}
}
};
var responses = await client.AdvancedSMSsendAsync(request);
foreach (var response in responses)
{
Console.WriteLine(
"Message ID: " + response.MessageID + Environment.NewLine +
"Error: " + response.SMSError + Environment.NewLine);
}
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("https://messaging.esendex.us/Messaging.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=\"https://messaging.esendex.us\">");
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\">17575559998</string>");
sb.append("<string xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">17575559999</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);
}
}
<?php
// Send SMS messages using SOAP client
// Send different messages to different numbers with one method.
$client = new SoapClient('https://messaging.esendex.us/Messaging.svc?wsdl');
$licenseKey = '(your license key here)';
$unicode = true;
$concat = true;
$PhoneNumbersArray1 = array('0123456789', '4567891230');
$PhoneNumbersArray2 = array('1234567890', '7652212120');
$Message1 = 'Hello World';
$Message2 = 'Goodbye World';
$RequestArray = array(
array(
'AssignedDID' => '', // If you have a Dedicated Line, you would assign it here.
'Message'=>$Message1,
'PhoneNumbers'=>$PhoneNumbersArray1,
'ReferenceID' => '', // User defined reference, set a reference and use it with other SMS functions.
// 'ScheduledDateTime' => '2010-05-06T16:06:00Z', // This must be a UTC time. Only Necessary if you want the message to send at a later time.
'StatusPostBackURL' => '' // Your postback URL for responses.
)
, array(
'AssignedDID' => '',
'Message'=>$Message2,
'PhoneNumbers'=>$PhoneNumbersArray2,
'ReferenceID' => '',
'ScheduledDateTime' => '2010-05-06T16:06:00Z',
'StatusPostBackURL' => ''
)
);
$request = new AdvancedCallRequestData($licenseKey, $RequestArray, $unicode, $concat);
// print_r($request);
$result = $client->AdvancedSMSsend($request);
print_r($result);
class AdvancedCallRequestData {
public $AdvancedRequest;
function AdvancedCallRequestData($licenseKey, $requests, $unicode, $concat) {
$this->AdvancedRequest = array();
$this->AdvancedRequest['Concatenate'] = $concat;
$this->AdvancedRequest['IsUnicode'] = $unicode;
$this->AdvancedRequest['LicenseKey'] = $licenseKey;
$this->AdvancedRequest['SMSRequests'] = $requests;
}
}
?>
<?php
// 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 = 'https://messaging.esendex.us/Messaging.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 HTTP headers and comment out the HTTP headers code line above.
// curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($cURL);
curl_close($cURL);
print_r($result)
?>
{
"Concatenate": true,
"IsUnicode": true,
"LicenseKey": "1627aea5-8e0a-4371-9022-9b504344e724",
"SMSRequests": [
{
"AssignedDID": "String content",
"Message": "String content",
"PhoneNumbers": [
"String content"
],
"ReferenceID": "String content",
"ScheduledDateTime": "\/Date(928164000000-0400)\/",
"StatusPostBackURL": "String content"
}
]
}
[
{
"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)\/"
}
]
<SMSAdvancedRequest xmlns="http://schemas.datacontract.org/2004/07/SmsWS">
<Concatenate>true</Concatenate>
<IsUnicode>true</IsUnicode>
<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>
<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>
<SMSResponse>
<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>
</ArrayOfSMSResponse>