This endpoint allows you to send an SMS to a desired phone number.
| Method | Endpoint |
|---|---|
POST
|
https://messaging.bulkitsms.com/api/services/sendsms
|
| Header | Description | Value |
|---|---|---|
| Content-Type | The Content-Type representation header is used to indicate the original media type of the resource (prior to any content encoding applied for sending). |
application/json
|
To send an SMS, you are required to pass in the 5 parameter listed below. A successful request will receive a unique identifier (messageid)
which can be used in the webhook once a delivery report is received from the Mobile Network Operator.
A failed request will receive appropriate and descriptive responses; and these can guide you in adding what's missing.
| Parameter | Description | Sample value |
|---|---|---|
| apikey | This is a unique identifier for your client account. |
aesfdgb5trdfd
|
| apisecret | This is the token that is used for validation. It is generated from your "client account" section on the portal.
Safeguard this key and keep it secret.
|
esrg34werstes4rsed4df4edd
|
| message | This is the message that needs to be sent to the phone number. An automatic opt-out will be added for promotional messages. |
Hello there {{name}}. Happy birthday!
|
| shortcode | This is your branded sender ID or shortcode. |
BULK_IT
|
| mobile | This is the phone number that is set to receive the message. |
254712345678
0712345678
712345678
|
Expected JSON payload.
{
"apikey":"{{apikey}}",
"apisecret":"{{apisecret}}",
"message":"This is a test SMS using Language",
"shortcode":"{{senderId}}",
"mobile":"{{mobile}}"
}
Sample success response.
{
"responsecode": "200",
"responsedescription": "Success",
"mobile": "254712345678",
"messageid": "uniqueString",
"networkid": "networkId",
"messagecost": "total cost"
}
curl --location --request POST 'https://messaging.bulkitsms.com/api/services/sendsms' \
--header 'Content-Type: application/json' \
--data-raw '{
"apikey":"uniqueIdentifer",
"apisecret":"someSecretThatOnlyYouKnow",
"message":"This is a test SMS using CURL",
"shortcode":"CoolCompany",
"mobile":"254712345678"
}'
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
)
func main() {
apikey := "uniqueIdentifer"
apisecret := "someSecretThatOnlyYouKnow"
receiver := "254712345678"
message := "This is a test SMS using Golang"
senderId := "CoolCompany"
values := map[string]string{
"apikey": apikey,
"apisecret": apisecret,
"mobile": receiver,
"message": message,
"shortcode": senderId,
}
json_data, err := json.Marshal(values)
if err != nil {
log.Fatal(err)
}
resp, err := http.Post(
"https://messaging.bulkitsms.com/api/services/sendsms",
"application/json",
bytes.NewBuffer(json_data),
)
if err != nil {
log.Fatal(err)
}
var res map[string]interface{}
json.NewDecoder(resp.Body).Decode(&res)
fmt.Println(res)
}
<?php
$url = 'https://messaging.bulkitsms.com/api/services/sendsms/';
$apiKey = 'uniqueIdentifer';
$apiSecret = 'someSecretThatOnlyYouKnow';
$senderId = 'CoolCompany';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json'
)
); //setting the header
$curl_post_data = array(
//Fill in the request parameters with valid values
'apikey' => $apiKey,
'apisecret' => $apiSecret,
'mobile' => '0712345678',
'message' => 'This is a test SMS using PHP',
'shortcode' => $senderId,
);
$data_string = json_encode($curl_post_data);// json encode the data
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
$bulkit_response = curl_exec($curl);
print_r($bulkit_response);
?>