Using RESTful API to send text messages
Back to Articles
SMS SMPP API Reference Telecom Howto

Using RESTful API to send text messages

November 1, 2018 2 min
Aivis Olsteins

Aivis Olsteins

Sending text messages is one of the most recent features added to SAARA system. It supports several ways to deliver Mobile Terminated (MT) messages to the end client:

  1. Most simplest way is to open a web interface on SAARA server, login as end user and send SMS from there. It is simple and handy for one off sending of one or few messages. It is not suitable for server-to-server connection or automated message delivery.
  2. SMPP protocol is industry standard for text message sending between Message Entities (ESMEs) and Mesage Centers. However, it requries implementation of SMPP which is not always straigh forward and easy.
  3. RESTful APIs are a popular method for machine-to-machine communication, and can be implemented much easier, since there are plenty of free and commercial suftware packages, libraries and tools which implement or support this functionality.

Here we will discuss the latter method. The step by stepo guide of how to set up SAARA system for MT message sending can be found at this link, and more specifically, the guide how to set up API support for SMS sending is located here.

The API is implemented with following API call:

POST /sms/send

{
  "to": "1234567890",
  "from": "9876543210",
  "content": "Hello, world!"
}

The above request sends text mesage "Hello, world" to phone number 1234567890 and the sender ID displayed on the recipients screen will be 987654321

The API will respond with confirmation where the body will contain message like:

{
  "code": 0,
  "status": 200,
  "data": "accepted",
  "request_id": "29737936-96c9-496f-aa13-1cd3a4544417"
}

Note, there is request_id attribute in response. It can be used in further requests to obtain status of the message delivery and billing data if necessary.

API client can be implemented in many languages. The quickest way, without actually writing any line of code is either via browser addons, like RESTClient add-on for Mozilla Firefox or Advanced REST Client for Google Chrome. Other way is to use curl, Linux CLI tool:

curl -X POST -H 'Authorization: token U51U9KhRl0t53n9W' -i 'http://server.address/api/sms/send' --data '{
    "to": "1234567890",
    "from":"9876543210",
    "content":"Hello world!"
}'

 

Share this article

Aivis Olsteins

Aivis Olsteins

An experienced telecommunications professional with expertise in network architecture, cloud communications, and emerging technologies. Passionate about helping businesses leverage modern telecom solutions to drive growth and innovation.

Related Articles

Case Study: Global Communications Company

Case Study: Global Communications Company

A leading communications company used our cloud Voice platform to send 30 million OTP calls per month to their customers, resulting in cost reduction and incrased conversion

Read Article
Bridging The Delay Gap in Conversational AI: The Backpressure Analogy

Bridging The Delay Gap in Conversational AI: The Backpressure Analogy

Conversational AI struggles with the time gap between text generation and speech synthesis. A “backpressure” mechanism, akin to network data flow control, could slow text generation to match speech synthesis speed, improving user interaction.

Read Article
How Voice AI Agents Can Automate Outbound Calls and Unlock New Opportunities for Businesses: A Deeper Dive

How Voice AI Agents Can Automate Outbound Calls and Unlock New Opportunities for Businesses: A Deeper Dive

AI voice agents transform healthcare scheduling by reducing costs, administrative tasks, and no-shows. They offer 24/7 service, multilingual support, proactive reminders, and valuable insights, improving efficiency and patient experiences.

Read Article
How to Fix Your Context: Mitigating and Avoiding Context Failures in LLMs

How to Fix Your Context: Mitigating and Avoiding Context Failures in LLMs

Larger context windows in LLMs cause poisoning, distraction, confusion, and clash. Effective context management (RAG, pruning, quarantine, summarization, tool loadouts, offloading) remains essential for high-quality outputs.

Read Article

SUBSCRIBE TO OUR NEWSLETTER

Stay up to date with the latest news and updates from our telecom experts