SMS API

SimpleSMSsend

This method sends an SMS message to one recipient. This method is deprecated: use SendMessage instead.

Endpoint

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

Syntax

SimpleSMSsend(PhoneNumber, Message, LicenseKey)

Request Parameters

Parameter NameDescriptionData TypeRequiredSample Value
PhoneNumberRecipient number.StringTrue7575550000
LicenseKeyYour license key.GUIDTrue00000000-0000-0000-0000-000000000000
MessageText content for the message.StringTrueThis is a sample message.

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.

C#

// 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 response = await client.SimpleSMSsendAsync(YOUR_TO_NUMBER, message, YOUR_LICENSE_KEY);

Console.WriteLine(
    "Message ID: " + response.MessageID + Environment.NewLine +
    "Error: " + response.SMSError + Environment.NewLine);

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 SimpleSMSSend{
    public static void main(String[] args) {
        try {
            URL url = new URL("https://messaging.esendex.us/Messaging.svc/SimpleSMSsend?"
                            + "PhoneNumber=17575559999"
                            + "&Message=JAVA+Test"
                            + "&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) {
        }
    }
}

JSON Response

{
	"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)\/"
}

PHP with cURL

<?php

// The following example was built using PHP 5.3.2 using cURL

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

?>

XML Response

<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>

Let’s start sending, together.