API Documentation on SMSALES
Welcome to SMSALES API,this api is organized around REST API. Our API has predictable resource-oriented URLs, accepts json/form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs that is GET and POST. You can invoke our API endpoints using REST clients like Postman or SoapUI and command line tools like curl and Node.js.
The SMSALES API only accepts the Content-Type: application/json & Accept: application/json
https://api.smsales.co.ke/api/v1/token
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.smsales.co.ke/api/v1/token',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Basic ACCOUNT_API_TOKEN'
}
}
{
"data": {
"Token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvYXBpLnNtc2FsZXMuY28ua2VcL2FwaVwvdjFcL3Rva2VuIiwiaWF0IjoxNjIxOTY1OTk5LCJleHAiOjE2MjE5Njk1OTksIm5iZiI6MTYyMTk2NTk5OSwianRpIjoiNUlvc3NjdlRqZDU3bVdLcyIsInN1YiI6IjhiNWE5ZmEwLTM3ODYtNDRhOS05NmEwLWVlMTlmOTU2NDVjZiIsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjcifQ.mioHmrN-KJb8_rJd9FayfhBGI6G8Kg6g9nNg8c4GxjM",
"TokenType": "Bearer",
"Expires": 3600
}
}
For more details see Account Api Token.
https://api.smsales.co.ke/api/v1/sms
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.smsales.co.ke/api/v1/sms',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer GIVE_THE_GENERATED_BEARER_TOKEN'
}
}
https://api.smsales.co.ke/api/v1/sms/balance/account
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.smsales.co.ke/api/v1/sms/balance/account',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer GIVE_THE_GENERATED_BEARER_TOKEN'
}
}
https://api.smsales.co.ke/api/v1/sms/balance/sender
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.smsales.co.ke/api/v1/sms/balance/sender',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer GIVE_THE_GENERATED_BEARER_TOKEN'
}
}
https://api.smsales.co.ke/api/v1/sms/send
Params
{
"api_sender" => "shiftech",// required check on your senderID's list for the API Sender
"message" => "Hello Smsales.",// required
"phone_numbers" => ["2547XXXXXXXX","2540XXXXXXXX","2547XXXXXXXX"],// required
"scheduled_at" => "Y-m-d H:i:s", // optional
"callback_url"=> "https://yourdomain/report"// optional this should be a POST request
}
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.smsales.co.ke/api/v1/sms/send',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer GIVE_THE_GENERATED_BEARER_TOKEN'
},
body: JSON.stringify({"api_sender":"shiftech","message":"Hello","phone_numbers":["2547XXXXXXXX","2540XXXXXXXX","2547XXXXXXXX"]})
}
{
"data": {
"batch": "1DIIPJGDP4",
"message": "Accepted for dispatch..."
}
}
CallBack Results if provided.
{
"sent":true,
"sender":"SHIFTECH",
"apiSender":"shiftech",
"phoneNumbers":[
"254XXXXXXXXX",
"254XXXXXXXXX",
"254XXXXXXXXX"
],
"batch":"1DIIPJGDP4",
"account":{
"smsBalance":"663",
"smsUsage":"24"
}
}
Having trouble with API integration? Check out our libraries or contact support and we’ll help you sort it out.