Sidebar Menu

SimpleSMSsendWithPostback

This method sends an SMS message to one recipient. The API will automatically post information to the specified URL when text messages are sent or received. This method is deprecated: use SendMessage instead.

Endpoint

GET:
https://messaging.esendex.us/messaging.svc/SimpleSMSsendWithPostback?PhoneNumber={PHONENUMBER}&Message={MESSAGE}&LicenseKey={LICENSEKEY}&StatusPostBackURL={STATUSPOSTBACKURL}

Syntax

SimpleSMSsendWithPostback(PhoneNumber, Message, LicenseKey, StatusPostBackURL)

Request Parameters

Parameter Name Description Data Type Required Sample Value
PhoneNumber

Recipient number.

String True 7575550000
LicenseKey

Your license key.

GUID True 00000000-0000-0000-0000-000000000000
Message

Text content for the message.

String True This is a sample message.
StatusPostBackURL

URL to send postbacks to.

String True http://example.com/postback.aspx

Response

Returns: SMSResponse object

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 message = "Hello, this is a test.";
var postbackUrl = YOUR_POSTBACK_URL;
var response = await client.SimpleSMSsendWithPostbackAsync(YOUR_TO_NUMBER, message, YOUR_LICENSE_KEY, postbackUrl);

Console.WriteLine(
    "Message ID: " + response.MessageID + Environment.NewLine +
    "Error: " + response.SMSError + Environment.NewLine);
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 SimpleSMSSendWithPostBack{
    public static void main(String[] args) {
        try {
            URL url = new URL("https://messaging.esendex.us/Messaging.svc/SimpleSMSsendWithPostBack?"
                            + "PhoneNumber=17575559999"
                            + "&Message=JAVA+Test"
                            + "&StatusPostBackURL=http://www.yourpostbackurl.com"
                            + "&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) {
        }
    }
}
<?php

// The following example was built using PHP 5.3.2. Your setup may differ, so please ensure that your PHP 5.x version supports the SOAPClient class.


// Create a new soap client based on the SMS Notify! WCF service
$client = new SoapClient('https://messaging.esendex.us/Messaging.svc?wsdl');

// Specify required info to send a text message
$param = array(
  'PhoneNumber' => '5555555555',
  'LicenseKey' => '(LicensKey)',
  'Message' => 'test',
  'StatusPostBackURL' => '(PostBackURL)'
);

// Send the text message
$result = $client->SimpleSMSsendWithPostback($param);

// View the response from Esendex
print_r($result);

?>
<?php

$url = 'https://messaging.esendex.us/Messaging.svc/SimpleSMSsendWithPostback?PhoneNumber=(To Phone Number)&Message=(Message)&LicenseKey=(License Key)&StatusPostBackURL=(Your Postback Url)';
$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);

?>
{
	"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)\/"
}
<SMSResponse xmlns="http://sms2.cdyne.com">
  <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>