Welcome Geeks
Choose a service on the left to browse API endpoints, request examples, and response formats.
Get Into Messaging!
SMS API Endpoint
https://api.taifamobile.co.ke/sms/sendsmsBelow is a quick step by step guide on how to integrate into our Bulk and Short code / Premium messaging gateway through an application programming interface (API).
To use this API, you need an API Key. If you have already signed up, you can get your API Key from your account.
NOTE: You can import the cURL examples into Postman and generate sample code in different languages.
Send SMS - Bulk & Shortcodes
cURL example
curl --location --request POST 'https://api.taifamobile.co.ke/sms/sendsms' \
--header 'api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"mobile": "+254707556633",
"response_type": "json",
"sender_name": "TaifaMobile",
"service_id": 0,
"message": "This is a message.\n\nRegards\nTaifa Mobile Ltd"
}'PHP example
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.taifamobile.co.ke/sms/sendsms',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 15,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"mobile": "+254707556633",
"response_type": "json",
"sender_name": "TaifaMobile",
"service_id": 0,
"message": "This is a message.\n\nRegards\nTaifa Mobile Ltd"
}',
CURLOPT_HTTPHEADER => array(
'api-key: YOUR_API_KEY',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;Send a message to a mobile subscriber using a Sender Name (alphanumeric sender ID):
https://api.taifamobile.co.ke/sms/sendsmsParameters
| Field | Type | Description |
|---|---|---|
| api-key | String | Your API key. It goes to the header. |
| mobile | String | The customer mobile number. Can be 722xxxyyy, 0722xxxyyy, or +254722xxxyyy. For multiple numbers, separate with commas. |
| response_type | String | [Optional, defaults to json] either json or plain. |
| sender_name | String | The origination alphanumeric or numeric code, e.g. TaifaMobile or 12345 for shortcode messages. |
| service_id | Integer | Identifier of the service allocated to the customer. This is always 0 for bulk messaging. |
| link_id | String | [Optional] Leave empty for bulk messages. For shortcode on-demand messages, include the received link_id. |
| message | String | The message to send. Maximum 920 characters (up to 6 SMS units). Every SMS unit is charged. |
Messaging Status Codes
Success status
[
{
"status_code": "1000",
"status_desc": "Success",
"message_id": 8692671,
"mobile_number": "+254707556633",
"network_id": "1",
"message_cost": "0.75",
"credit_balance": "7231"
}
]Failed status
[
{
"status_code": "1001",
"status_desc": "Invalid short code",
"message_id": "0",
"mobile_number": "+254707556633",
"network_id": "",
"message_cost": "",
"credit_balance": ""
}
]| Status Id | Status Code | Status Description |
|---|---|---|
| 1 | 1000 | Success |
| 2 | 1001 | Invalid short code |
| 3 | 1002 | Network not allowed |
| 4 | 1003 | Invalid mobile number |
| 5 | 1004 | Low bulk credits |
| 6 | 1005 | Internal system error |
| 7 | 1006 | Invalid credentials |
| 8 | 1007 | Db connection failed |
| 9 | 1008 | Db selection failed |
| 10 | 1009 | Data type not supported |
| 11 | 1010 | Request type not supported |
| 12 | 1011 | Invalid user state or account suspended |
| 13 | 1012 | Mobile number in DND |
| 14 | 1013 | Invalid API Key |
| 15 | 1014 | IP not allowed |
Validate Mobile Number
cURL example
curl --location --request GET 'https://api.taifamobile.co.ke/sms/mobile?mobile=707556633' \
--header 'api-key: YOUR_API_KEY'PHP example
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.taifamobile.co.ke/sms/mobile?return=json&mobile=707556633',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 15,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'api-key: YOUR_API_KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;Validate and check the network a mobile number belongs to.
Request Parameters
| Field | Type | Description |
|---|---|---|
| return | String | The return type: either json or just the validated mobile number. |
| mobile | String | The mobile number to be validated. |