Number API

This API allows businesses send messages to customers using Termii's auto-generated messaging numbers that adapt to customers location.

Send Message

Endpoint : https://BASE_URL/api/sms/number/send

Request Type : POST

OptionsRequiredDescription
api_keyyesstring
Your API key (It can be found on your Termii dashboard).
toyesstring
Represents the destination phone number. Phone number must be in the international format (Example: 2349012672711)
smsyesstring
Text of a message that would be sent to the destination phone number


Note on special Characters: 1 page = 160 characters Your message content was 5 pages as a result of the special character in your message content. Special characters reduces your message count from 160 characters per message to 70 characters per message.
Here are a few of them
; // ^ { }  \ [ ~ ] | € ' ”```
{
      "to": "2347089509111",
      "sms": "Hi there, testing Termii",
      "api_key": "Your API Key"
  }
var data = {
          "to": "2347449229657",
          "sms":"Hi there, testing Termii",
          "api_key":"Your API key",
          };

var data = JSON.stringify(data);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
  console.log(this.responseText);
}
});

xhr.open("POST", "https://BASE_URL/api/sms/number/send");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Content-Type", "application/json");

xhr.send(data);


var request = require('request');
var data = {
          "to":"2347044501257",
          "sms":"Hi there, testing Termii",
          "api_key":"Your API key",
          };
var options = {
'method': 'POST',
'url': 'https://BASE_URL/api/sms/number/send',
'headers': {
  'Content-Type': ['application/json', 'application/json']
},
body: JSON.stringify(data)

};
request(options, function (error, response) { 
if (error) throw new Error(error);
console.log(response.body);
});

import requests
url = "https://BASE_URL/api/sms/number/send"
payload = {
           "to": "2347089229611",
           "sms": "Hi there, testing Termii",
           "api_key": "Your API Key"
       }
headers = {
'Content-Type': 'application/json',
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.text)
RestClient restClient = new RestClient("https://BASE_URL/api/sms/number/send");

//Creating Json object
JObject objectBody = new JObject();
objectBody.Add("to","+2347033511657");
objectBody.Add("sms","Hi there, testing Termii");
objectBody.Add("api_key","Your API Key");

RestRequest restRequest = new RestRequest(Method.POST);

restRequest.AddHeader("Content-Type", "application/json");
restRequest.AddParameter("application/json", objectBody,  ParameterType.RequestBody);
IRestResponse restResponse = restClient.Execute(restRequest);
Console.WriteLine(restResponse.Content);

Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post(" https://BASE_URL/api/sms/number/send")
.header("Content-Type", "application/json")
.body("{\r\n \"to\": \"2347089239667\",\r\n  \"sms\": \"Hi there, testing Termii \",\r\n   \"api_key\": \"Your API Key\"\r\n    }")
.asString();
$curl = curl_init();
$data = array("to" => "2347230545644","sms"=>"Hi there, testing Termii","api_key" => "Your API key",  );

$post_data = json_encode($data);

curl_setopt_array($curl, array(
CURLOPT_URL => "https://BASE_URL/api/sms/number/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $post_data,
CURLOPT_HTTPHEADER => array(
  "Content-Type: application/json"
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Response

   {
     "code": "ok",
     "message_id": "174749423",
     "message": "Successfully Sent",
     "balance": 8,
     "user": "Seun Junior"
   }
Updated at, Wednesday, November 20, 2024