SMS Messaging API
HTTP API to send and receive SMS messages to every country in the world.
Deprecated API
Although, this API is still supported, we suggest using a more modern and feature-rich Omnichannel API for sending SMS messages.
Overview
- Make an HTTPS request to SMS Messaging API
- Check the response code and store
Message ID
to match DLR later - SMS is sent to the handset
- Handset responds with Delivery Report (DLR).
- If configured Messente forwards the DLR to the callback URL.
Features
Feature | Availability |
---|---|
Send SMS | |
Receive SMS | |
Send Flash SMS | |
Transactional and marketing messages | |
SMPP connection | |
Delivery reports | |
Schedule messages |
Get Started
Sending an SMS is super simple
- Python
- PHP
- Java
import messente
api = messente.Messente(username="YOUR_API_USERNAME", password="YOUR_API_PASSWORD")
# Send SMS
response = api.sms.send({
"from": "MyDelivery",
"to": "+44000000000",
"text": "Your parcel will be delivered at 10AM"
})
if response.is_ok():
print("Message sent:", response.get_sms_id())
else:
print("Message failed:", response.error_code)
// 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());
}
}
}