Get Into Messaging!

SMS API Endpoint

     https://api.crowdcomm.co.ke/api/sms/sendsms
            

Below 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.crowdcomm.co.ke/api/sms/sendsms' \
--header 'h_api_key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "mobile": "254720823611",
    "response_type": "json",
    "sender_name": "CROWD_info",
    "service_id": 0,
    "message": "This is a message.\n\nRegards\nCrowd Communications Company Ltd"
}'

# PHP example
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.crowdcomm.co.ke/api/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": "254720823611",
    "response_type": "json",
    "sender_name": "CROWD_info",
    "service_id": 0,
    "message": "This is a message.\n\nRegards\nCrowd Communications Company Ltd"
}',
  CURLOPT_HTTPHEADER => array(
    'h_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.crowdcomm.co.ke/api/sms/sendsms

Request Type:
POST


Parameters

Field Type Description
h_api_key String Your API key. It goes to the header
mobile String The customer mobile number. This can be any format e.g. 722xxxyyy, 0722xxxyyy, +254 722xxx yyy
response_type String [Optional, defaults to json] either json or plain
sender_name String The origination alphanumeric or numeric code. e.g. CROWD_info for bulk messages or 12345 for shortcode messages
service_id Integer An identifier of the service allocated to the customer. This is always 0 for bulk messaging
link_id String [Optional] Leave this empty for bulk messages. For shortcode messages, the link_id received on incoming on-demand messages must be included here.
message String The message to send to the end user. This can be to a maximum or 920 characters or 6 SMS units. Note that every unit of an SMS is charged.

Messaging Status Codes



# Success status :
[
  {
    "status_code": "1000",
    "status_desc": "Success",
    "message_id": 7858827,
    "mobile_number": "254720823611",
    "network_id": "1",
    "message_cost": "0.75",
    "credit_balance": "8525",
 }
]

# Failed status
[
  {
    "status_code": "1001",
    "status_desc": "Invalid short code",
    "message_id": "0",
    "mobile_number": "254720823611",
    "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 vas 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
16 1015 Missing Parameter
17 1016 Monthly credit limit reached

Validate Mobile Number



#cURL example
curl --location --request GET 'https://api.crowdcomm.co.ke/api/sms/mobile?mobile=720823611' \
--header 'h_api_key: '

# PHP example
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.crowdcomm.co.ke/api/sms/mobile?return=json&mobile=720823611',
  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(
    'h_api_key: '
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Validate and check the network a mobile number belongs to:

Request Type:
GET


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

SEND Delivery Report



#cURL example
curl --location --request POST '/client.endpoint/dlr' \

# PHP example
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => '/client.endpoint/dlr',
  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 =>'
  { "messageId":"27312989",
  "dlrTime":"2022-02-22 11:46:42",
  "dlrStatus":"1",
  "dlrDesc":"DeliveredToTerminal",
  "tat":10005,
  "network":"1",
  "destaddr":"254767209917",
  "sourceaddr":"118",
  "origin":"Safaricom"}
  '
));

$response = curl_exec($curl);
curl_close($curl);
echo $response;

Send Delivery report from Mobile Network Operator in realtime:

Request Type:
POST


Request Parameters

Field Type Description
messageId Integer The messageId which is returned with every successful request.
dlrTime DateTime DateTime for the time of delivery.
dlrStatus Integer Status value as integer.
dlrDesc String Description of the delivery report staus.
tat Integer The time it took for system to get report.
network Integer Numeric indicator of the Network.
destaddr String The mobile to which the message was sent to.
sourceaddr String The SenderId which originated the message
origin String The The nework name

GET ACCOUNT BALANCE



$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.crowdcomm.co.ke/api/sms/getbalance',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_POSTFIELDS =>'{
      "response_type":"json"
}',
  CURLOPT_HTTPHEADER => array(
    'h_api_key: adeedccd2199f41f7e731e3150b4c8009de4cded064b6407a310573e28978680',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Get Account balance for your account using only your API KEY https://api.crowdcomm.co.ke/api/sms/getbalance

Request Type:
POST


Request Parameters

Field Type Description
h_api_key String Your API key. It goes to the header
response_type String [Optional, defaults to json] either json or plain