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.
Endpoint
POST (HTTP): https://messaging.esendex.us/Messaging.svc/AdvancedSMSsend
Syntax
AdvancedSMSSend(Request)
Request Parameters
Parameter Name | Description | Data Type | Required | Sample Value |
---|---|---|---|---|
Concatenate |
Flag to indicate if concatenation headers should be added to messages that were broken into fragments. (Not supported by all devices.). |
Boolean
|
False | False |
IsUnicode |
Flag to indicate if message should be sent using Unicode encoding (UCS-2). If true, the max message character count is 70. |
Boolean
|
False | False |
LicenseKey |
Your license key, as required to invoke this web service. |
String
|
True | F01d89fd-5155-5455-5585-e84ab8de8591 |
SMSRequests |
An array of SMS requests. |
Array of SMSRequest objects
|
True |
Response
Returns: AdvancedSMSSendResponse
object
Code Samples
// Add this service reference to your project: http://sms2.esendex.us/sms.svc?wsdl
using AdvancedSMSSend.WSDL;
namespace AdvancedSMSSend
{
class Program
{
static void Main(string[] args)
{
IsmsClient client = new IsmsClient("sms2wsHttpBinding");
SMSAdvancedRequest advReq = new SMSAdvancedRequest();
advReq.Concatenate = true; // Optional.
advReq.IsUnicode = true; // Optional. If advReq.IsUnicode = true; max message character length is 70.
advReq.LicenseKey = new Guid("YOUR LICENSE KEY");
List<SMSRequest> reqs = new List<SMSRequest>();
SMSRequest req = new SMSRequest();
req.Message = "Test Advanced SMS"; // Single-line message.
// req.Message = "SMS Advanced" + "\n" + "Line 1" + "\n" + "Line 2"; // Multi-line message
req.PhoneNumbers = new string[] {"17575449510", "17579510544"}; // You could send the same message to multiple phone numbers. (You will get back a response packet per phone number.)
req.ReferenceID = "2863172"; // Will return with responses. (Optional)
req.StatusPostBackURL = "http://www.esendex.us/postback.asmx"; // (Optional)
req.ScheduledDateTime = new DateTime(2012, 09, 25, 14, 15, 0).ToUniversalTime();
// ScheduledDateTime Format is Year, Month, Date Hour, Minutes, Seconds. The time can be set in your local time zone as it is converted to UTC.
req.AssignedDID = "1555123456"; // Assigned DID. (Optional)
reqs.Add(req);
// Add more requests here...
advReq.SMSRequests = reqs.ToArray(); // Adds the array of requests to the SMSAdvancedRequest object.
SMSResponse[] smsResponses = client.AdvancedSMSsend(advReq);
foreach (var item in smsResponses)
{
Console.WriteLine(item.MessageID + " " + item.SMSError);
}
Console.ReadLine();
client.Close();
}
}
}
' Add a service reference to http://sms2.esendex.us/sms.svc?wsdl
Imports AdvancedSMS.WSDL
Module Module1
Sub Main()
Dim client As WSDL.IsmsClient = New WSDL.IsmsClient("sms2wsHttpBinding")
Dim advReq As New WSDL.SMSAdvancedRequest()
Dim smsReqs As List(Of WSDL.SMSRequest) = New List(Of WSDL.SMSRequest)
Dim req As WSDL.SMSRequest = New WSDL.SMSRequest()
Dim phoneNumbers As List(Of String) = New List(Of String)
advReq.Concatenate = true ' Optional.
advReq.IsUnicode = true ' Optional. If advReq.IsUnicode = true max message character length is 70.
advReq.LicenseKey = New Guid("YOUR LICENSE KEY")
req.Message = "VB.NET SMS Advanced" ' Single-line message
' req.Message = "VB.NET SMS Advanced" & Environment.NewLine & "Line 1" & Environment.NewLine & "Line 2" ' Multi-line message
req.PhoneNumbers = New String() {"17575449510", "1555123456"}
req.ScheduledDateTime = New DateTime(2011, 8, 2, 13, 10, 0).ToUniversalTime
' ScheduledDateTime Format is Year, Month, Date Hour, Minutes, Seconds. The time can be set in your local time zone as it is converted to UTC.
req.AssignedDID = "ASSIGNED DID NUMBER HERE" ' Optional
smsReqs.Add(req)
advReq.SMSRequests = smsReqs.ToArray()
Dim resp As WSDL.SMSResponse() = client.AdvancedSMSsend(advReq)
For Each item In resp
Console.WriteLine(Convert.ToString(item.MessageID) & " " & "SMS Error: " & Convert.ToString(item.SMSError))
Next
Console.ReadLine()
client.Close()
End Sub
End Module
Dim thexml
' The xml may look sloppy, but it must be a single line to work.
' Look at http://sms2.esendex.us/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.esendex.us""><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>2020-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.esendex.us/sms.svc/AdvancedSMSsend", false)
Call xmlHttp.setRequestHeader("Content-Type", "text/xml")
Call xmlHttp.send(thexml)
document.write(xmlHttp.responseText)
<?php
// Send SMS messages using SOAP client
// Send different messages to different numbers with one method.
$client = new SoapClient('http://sms2.esendex.us/sms.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 = 'http://sms2.esendex.us/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 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)
?>
require 'uri'
require 'net/http'
url = URI("http://sms2.esendex.us/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":"Esendex test message.",
"PhoneNumbers":["17575449510"],
"ReferenceID":"123",
"StatusPostBackURL":"www.yourpostbackurlhere.com",
"ScheduledDateTime":"\/Date(928164000000)\/"}]
}'
response = http.request(request)
puts response.read_body
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.esendex.us/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.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\">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);
}
}
{
"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)\/",
"StatusPostBackURL": "String content"
}
]
}
[
{
"Cancelled": true,
"MessageID": "1627aea5-8e0a-4371-9022-9b504344e724",
"Queued": true,
"ReferenceID": "String content",
"SMSError": 0,
"SMSIncomingMessages": null,
"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.esendex.us">
<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>2020-05-31T11:20:00</ScheduledDateTime>
<StatusPostBackURL>String content</StatusPostBackURL>
</SMSRequest>
<SMSRequest xmlns="http://sms2.esendex.us">
<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>2020-05-31T11:20:00</ScheduledDateTime>
<StatusPostBackURL>String content</StatusPostBackURL>
</SMSRequest>
</SMSRequests>
</SMSAdvancedRequest>
<ArrayOfSMSResponse xmlns="http://sms2.esendex.us">
<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>2020-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>2020-05-31T11:20:00</SentDateTime>
</SMSResponse>
</ArrayOfSMSResponse>