SMS Messaging API Quickstart

Start sending SMS messages by following these simple steps.


Although we fully support this API we suggest using a more modern and feature-rich Omnichannel API.

Sending a message using the API is a three-step process.

  1. Sign up to Messente and receive your API keys (no credit card required).
  2. Verify your phone number as sender ID or request a branded Sender name .
  3. Using the API keys, make an API request with the desired message and recipient.

Upon sign up we will add you 1€ credit so you can test out the service immediately. With it you can send around 10-15 test messages.


1. Install a library

We provide libraries for Python, PHP and Java. For other languages, you can use the API by making HTTP request manually.

An alternative is to use an improved Omnichannel API that has wider support for libraries.


2. Send a single SMS

Use the following example to send an SMS using Messaging API.

Detailed API Reference on sending an SMS

import messente

api = messente.Messente(username="YOUR_API_USERNAME", password="YOUR_API_PASSWORD")
api.sms.send({"from": "SenderID", "to"="+XXXxxxxxxxxx", "text"="Your parcel will be delivered at 10AM"})

print("Message sent:", response.get_sms_id())
    
// Messente API username and password
define('MESSENTE_API_USERNAME', 'YOUR_API_USERNAME');
define('MESSENTE_API_PASSWORD', 'YOUR_API_PASSWORD');
define('MESSENTE_SMS_DLR_URL', 'https://myservice.com/dlr/messente/239d8/');

// Make HTTP call to Messente API
$url = 'https://api2.messente.com/send_sms/?'.
http_build_query(
  array(
    'username' => MESSENTE_API_USERNAME,
    'password' => MESSENTE_API_PASSWORD,
    'from' => 'MyDelivery',
    'to' => '+44000000000',
    'text' => 'Your parcel will be delivered at 10AM',
    'dlr-url' => MESSENTE_SMS_DLR_URL
  )
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

$response = curl_exec($ch);
list($resp, $code) = explode(' ', $response);

if ($resp == 'OK') {
  echo 'Message sent successfully with MessageID '.$code;
} else {
  echo 'Sending message failed with error code '.$code;
}
  
public class SendSmsSimpleExample {

    public static final String API_USERNAME = "YOUR_API_USERNAME";
    public static final String API_PASSWORD = "YOUR_API_PASSWORD";

    public static final String SMS_SENDER_ID = "YOUR_SENDER_ID";
    public static final String SMS_RECIPIENT = "+3721234567";
    public static final String SMS_TEXT = "Hey! Check out messente.com, it's awesome!";

    public static void main(String[] args) {

        // Create Messente client
        Messente messente = new Messente(API_USERNAME, API_PASSWORD);

        // Create response object
        MessenteResponse response = null;

        try {
            // Send SMS
            response = messente.sendSMS(SMS_SENDER_ID, SMS_RECIPIENT, SMS_TEXT);

            // Checking the response status
            if (response.isSuccess()) {

                // Get Messente server full response
                System.out.println("Server response: " + response.getRawResponse());

                //Get unique message ID part of the response(can be used for retrieving message delivery status later)
                System.out.println("SMS unique ID: " + response.getResult());

            } else {
                // In case of failure get failure message
                throw new RuntimeException(response.getResponseMessage());
            }
        } catch (Exception e) {
            System.err.println(e.getMessage());
            throw new RuntimeException("Failed to send SMS! " + e.getMessage());
        }

    }
}
    

Next steps

Now that you can send messages it's time to see if they reach the recipient by tracking delivery reports.