SMS

This API allows you to send SMS text messages to your audience. using automatic route switcher for fast message delivery. API accepts and returns JSON-encoded requests and responses.

post
Send SMS

https://api.tagget.io/engage/send_sms
API endpoint to send a SMS message through your Tagget account from a third-party app.
Request
Response
Request
Body Parameters
to
required
string
Recipient phone number (in the international format) of the SMS i.e +18397536474 or +16892725454, +1878463643
body
required
string
The actual content of your SMS
sender
required
string
Preferred alphanumeric sender name i.e Tagget
id
required
number
Your Tagget account id
token
required
string
Your Tagget account secret token
Response
200: OK
SMS has been sent successfully.
{
"status": 200,
"message": "SMS has been sent to recipient successfully.",
"data": {
"id": "YOUR_ID",
"token": "YOUR_TOKEN",
"sender": "Tagget",
"body": "Hello world",
"to": "+2348188216769"
}
}
400: Bad Request
Your SMS request wasn't successful.
{
"status": 400,
"message": "Error sending SMS message to recipient.",
"data": null
}
JavaScript
Python
NodeJS
PHP
Java
Untitled
Untitled
JavaScript
var data = JSON.stringify({
"id": "YOUR_ID",
"token": "YOUR_TOKEN",
"sender": "Tagget",
"body": "Hello world",
"to": "+18397536474 "
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.tagget.io/engage/send_sms");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.send(data);
Python
import requests
url = "https://api.tagget.io/engage/send_sms"
payload = "{\n\t\"id\":\"YOUR_ID\",\n\t\"token\":\"YOUR_TOKEN\",\n\t\"sender\":\"Tagget\",\n\t\"body\": \"Hello world\",\n\t\"to\": \"+2348188216769\"\n}"
headers = {
'content-type': "application/json",
'cache-control': "no-cache"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
NodeJS
var http = require("https");
var options = {
"method": "POST",
"hostname": "api.tagget.io",
"port": null,
"path": "/engage/send_sms",
"headers": {
"content-type": "application/json",
"cache-control": "no-cache"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ id: 'YOUR_ID',
token: 'YOUR_TOKEN',
sender: 'Tagget',
body: 'Hello world',
to: '+195848757465' }));
req.end();
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.tagget.io/engage/send_sms",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n\t\"id\":\"YOUR_ID\",\n\t\"token\":\"YOUR_TOKEN\",\n\t\"sender\":\"Tagget\",\n\t\"body\": \"Hello world\",\n\t\"to\": \"+18578476746\"\n}",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Java
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"id\":\"YOUR_ID\",\n\t\"token\":\"YOUR_TOKEN\",\n\t\"sender\":\"Tagget\",\n\t\"body\": \"Hello world\",\n\t\"to\": \"+183467364733\"\n}");
Request request = new Request.Builder()
.url("https://api.tagget.io/engage/send_sms")
.post(body)
.addHeader("content-type", "application/json")
.addHeader("cache-control", "no-cache")
.build();
Response response = client.newCall(request).execute();
require 'uri'
require 'net/http'
url = URI("https://api.tagget.io/engage/send_sms")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["cache-control"] = 'no-cache'
request.body = "{\n\t\"id\":\"YOUR_ID\",\n\t\"token\":\"YOUR_TOKEN\",\n\t\"sender\":\"Tagget\",\n\t\"body\": \"Hello world\",\n\t\"to\": \"+1985458475434\"\n}"
response = http.request(request)
puts response.read_body
var client = new RestClient("https://api.tagget.io/engage/send_sms");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n\t\"id\":\"YOUR_ID\",\n\t\"token\":\"YOUR_TOKEN\",\n\t\"sender\":\"Tagget\",\n\t\"body\": \"Hello world\",\n\t\"to\": \"+134867465475\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);