Skip to content

Latest commit

 

History

History
152 lines (138 loc) · 3.1 KB

README.md

File metadata and controls

152 lines (138 loc) · 3.1 KB

#Host Pro Sms API

Host Pro Sms API is build for Host Pro Sms - Bulk SMS Application

Step 2:

Get your API_KEY from https://sms.hostpro.co.ke/user/sms-api/info

$api_key = '--YOURAPIKEY--';

Step 3:

Change the from number below. It can be a valid phone number or a String

$from = 'senderID';

Step 4:

the number we are sending to - Any phone number

$destination = '254710000000';

For multiple number please use Comma (,) after every single number.

$destination = '254710000000,254721000000,25477000000,254713000000';

You can insert maximum 100 numbers using comma in single api request.

You have to must include Country code at beginning of the phone number.

$url = 'https://sms.hostpro.co.ke/sms/api';

// SMS Body

$sms = 'test message from HostProSMS';

// Unicode SMS

$unicode = '1'; //For Unicode message

// Voice SMS

$voice = '1'; //For voice message

// MMS SMS

$mms = '1'; //For mms message
$media_url = 'https://yourmediaurl.com'; //Insert your media url

// Schedule SMS

$schedule_date = '09/17/2018 10:20 AM'; //Date like this format: m/d/Y h:i A

// Create Plain/text SMS Body for request

$sms_body = array(
    'api_key' => $api_key,
    'to' => $destination,
    'from' => $from,
    'sms' => $sms
);

// Create Unicode SMS Body for request

$sms_body = array(
    'api_key' => $api_key,
    'to' => $destination,
    'from' => $from,
    'sms' => $sms,
    'unicode' => $unicode,
);

// Create Voice SMS Body for request

$sms_body = array(
    'api_key' => $api_key,
    'to' => $destination,
    'from' => $from,
    'sms' => $sms,
    'voice' => $voice,
);

// Create MMS SMS Body for request

$sms_body = array(
    'api_key' => $api_key,
    'to' => $destination,
    'from' => $from,
    'sms' => $sms, //optional
    'mms' => $mms,
    'media_url' => $media_url,
);

// Create Schedule SMS Body for request

$sms_body = array(
    'api_key' => $api_key,
    'to' => $destination,
    'from' => $from,
    'sms' => $sms,
    'schedule' => $schedule_date,
);

Step 6:

Instantiate a new Host Pro API request

$client = new HostproSMSAPI();

Send SMS

Finally send your sms through Host Pro SMS API

$response = $client->send_sms($sms_body, $url);

Get Inbox

Get your all message

$get_inbox=$client->get_inbox($api_key,$url);

Get Balance

Get your account balance

$get_balance=$client->check_balance($api_key,$url);

Response

Host Pro SMS API return response with json format, like:

{"code":"ok","message":"Successfully Send"}

Status Code

Status Message
ok Successfully Send
100 Bad gateway requested
101 Wrong action
102 Authentication failed
103 Invalid phone number
104 Phone coverage not active
105 Insufficient balance
106 Invalid Sender ID
107 Invalid SMS Type
108 SMS Gateway not active
109 Invalid Schedule Time
110 Media url required
111 SMS contain spam word. Wait for approval