This document provides a step-by-step process of integrating Taifa Mobile PRSP System into your web application and allow you to push your SMS to a user or a group of users.
- Download the TaifaMobile.php file above.
- Copy the downloaded file into your project directory.
- Follow the code below to send out an SMS.
require_once('PATH_TO_TAIFA_MOBILE_LIBRARY/TaifaMobile.php');
$tm = new TaifaMobile();
$message = "Lorem Ipsum is simply dummy text of the printing....";
$apiKey = "YOUR_GENERATED_API_KEY"; //Generate the API_KEY
$recepients = "07XXXXXXXX"; //Sending out single sms
$recepients = ["07XXXXXXXX", "07YYYYYYYY"]; //Sending out bulk sms
------ Send either single or multiple recepient SMS ------
$response = $tm->send_sms($recepients, $message, $apiKey);
------ Send using a specific service ------
$service_name = "SERVICE_NAME";//The name of the service to use.
$response = $tm->send_sms($recepients, $message, $apiKey, $service_name);
------ Send/ Respond to a specific on demand service using link Id ------
$linkId = "link id";//The link Id of the incoming message that you received.
$response = $tm->reply_sms($linkId, $message, $apiKey);
The response from the above function will return a JSON string in the below format:
{
"messageId":"b77d7e8e961bc52521ca25baddab068a", //35 characters
"status":"00",
"statusDescription":"Success",
}
Below is a list of the status and their respective statusDescription returned in the above function.
- 00 - Success
- 01 - Failed
- 97 - No enough funds
- 98 - Service not found
- 99 - Missing required details
TaifaMobile allows customers to specify call back URLs where data is sent upon receiving from the partner Telco. This data is sent using POST method and in JSON format.
The data below will be received in JSON format whenever a delivery report is received.
{
"timestamp":"0000-00-00 00:00:00"
"phoneNumber":"2547XXXXXXXX",
"messageId":"b77d7e8e961bc52521ca25baddab068a",
"status":"STATUS_MESSAGE"
}
The data below will be received in JSON format whenever a customer subscribes or unsubscribed to registered services.
{
"date":"YYYY-MM-DD HH:MM:SS",
"phone_number":"2547XXXXXXXX",
"service":{
"service_name":"SERVICE_NAME",
"keyword":"KEYWORD_USED"
},
"update_description":"ACTIVATION|DEACTIVATION"
}
The data below will be received in JSON format whenever an incoming message is received.
{
"message":"Lorem Ipsum...",
"phone_number":"2547XXXXXXXX",
"link_id":"14101445075801587923",
"service":{
"service_name":"SERVICE_NAME",
"keyword":"KEYWORD_USED"
},
"message_time":"0000-00-00 00:00:00"
}
Below are some of the delivery reports status (STATUS_MESSAGE) that you will receive through the API
- DeliveredToTerminal : Message has been delivered - UserNotExist : Number does not exist - Insufficient_Balance : Insufficient funds at user end
- DeliveryImpossible : Message has expired
- sender_ID blacklisted by user : Sender ID blocked by the user
- Invalid_Linkid : Incorrect link ID
- DeliveredNotificationNotSupported : Notification not supported