Skip to main content

SMS - API

Betatel's SMS API provides a powerful and reliable way to send messages instantly, ensuring seamless communication with your users. Whether you're sending transactional updates, promotional alerts, or authentication messages, our API is designed for speed, security, and global reach.

In this guide, we’ll focus on one of the most common SMS use cases: sending OTP (One-Time Password) messages. OTPs are essential for user authentication, account verification, and secure transactions, ensuring that only authorized users can access sensitive data or complete actions.

Follow the steps below to integrate and send OTP messages using Betatel’s SMS API with ease. πŸš€

Configure the API Endpoint​

Start by preparing the endpoint URL for your request.

https://api.betatel.com/api/smpp/client/send
  • Method: POST

Set Up the Headers​

Add the necessary headers for your API request:

ParamValueDescription
Content-typeapplication/jsonSpecifies the payload format.
x-api-key{{x-api-key}API key for authorization.

Craft the Request Body​

Design the JSON payload to include the sender, recipient, and the message content.

Example of body
{"from":"FACEBOOK", "to":"38761930305", "text":"Your code is 555345"}
FieldTypeRequiredDescription
fromstringYesThe sender ID or name (e.g., "FACEBOOK").
tostringYesThe recipient's phone number in international format.
textstringYesThe message content (e.g., "Your code is 555345").

Code Snippets​

Here's how to implement the API call in different programming languages:

Example - cURL
curl --location --globoff 'https:/api.betatel.com/api/smpp/client/send' \
--header 'Content-Type: application/json' \
--header 'x-api-key: β€’β€’β€’β€’β€’β€’' \
--data '{"from":"FACEBOOK", "to":"38761930305", "text":"Your code is 555345"}'

Understanding the Response​

Once the API processes your request, it returns a response containing a unique identifier for your message.

JSON Schema:

{
"uuid": "string"
}
  • uuid: A unique string to track the delivery and status of your message.

Outbound Message status check​

Tracking Message Status in Real-Time​

Betatel's SMS API allows you to programmatically track message status changes via status callbacks. These status updates help you monitor message delivery and troubleshooting.

Status Lifecycle​

OTP Illustration

When a message is sent, it transitions through multiple statuses:

StatusDescription
queuedMessage is queued for sending.
sentMessage has been successfully sent.
failedMessage failed to send.
deliveredMessage was successfully delivered to the recipient.
undeliveredMessage could not be delivered.
readMessage was read (Only applicable to WhatsApp).

Example Status Callback Payload​

When a status change occurs, Betatel will send an HTTP POST request to your configured status callback URL with the following payload:

JSON Schema:

{
"uuid": "e5b7c3f2-d8a6-4f6c-93b9-123456789abc",
"status": "delivered",
"to": "+38761930305",
"timestamp": "2025-02-03T12:34:56Z"
}
FieldTypeDescription
uuidstringUnique message identifier.
statusstringThe current status of the message.
tostringThe recipient's phone number.
timestampstring (ISO 8601)Time of status update.

Congratulations​

Congratulations! You've successfully integrated Betatel's SMS API to send OTP messages with ease. This guide ensures that your implementation adheres to best practices and provides a seamless experience for both developers and end-users.