SMS Xenda API

Your API key is available on the settings section on the web app.

End Point: https://smsxenda.com/api/
All requests in POST

WALLET BALANCE

Parameters
action = balance
apikey = {available on your settings page}

$postRequest = array(
    'action' => 'balance',
    'apikey' => '62a1c7a4f403f0f1ab773eaa36cc2e01'	
);

$cURLConnection = curl_init('https://smsxenda.com/api/');
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);

$apiResponse = curl_exec($cURLConnection);
curl_close($cURLConnection);

echo $apiResponse;

	

Responses

{"status":"failed","message":"invalid api key"}
{"status":"success","message":"35483.00"}

Any failed request will have the status as failed irrespective of the action.

SEND SMS

End Point: https://smsxenda.com/api/sendsms
Send to Single or Bulk Numbers

Parameters
apikey = {available on your settings page}
mode = 1
message = [sms content}
phone = {list of phone numbers comma separated for multiple}
sim = {SIM 1 is 0, while SIM 2 is 1}
refid = {optional user generated reference}

$postRequest = array(    
    'apikey' => '62a1c7a4f403f0f1ab773eaa36cc2e01',
	'mode' => 1,
	'message' => 'This is a sample message',
	'phone' => '08139235588,08135534866',
	'sim' => 0,
	'refid' => 'tst123'
);

$cURLConnection = curl_init('https://smsxenda.com/api/sendsms');
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);

$apiResponse = curl_exec($cURLConnection);
curl_close($cURLConnection);

echo $apiResponse;

	

Send to Contact Group

Parameters
apikey = {available on your settings page}
mode = 2
message = [sms content}
groupid = {groupid is available on the contact group page or can fetch via API}
sim = {SIM 1 is 0, while SIM 2 is 1}
refid = {optional user generated reference}

$postRequest = array(    
    'apikey' => '62a1c7a4f403f0f1ab773eaa36cc2e01',
	'mode' => 2,
	'message' => 'This is a sample message',
	'groupid' => 'sm_12uuiu',
	'sim' => 0,
	'refid' => 'tst345'
);

$cURLConnection = curl_init('https://smsxenda.com/api/sendsms');
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);

$apiResponse = curl_exec($cURLConnection);
curl_close($cURLConnection);

echo $apiResponse;

	

RESPONSES

{"status":"failed","message":"Phone number is missing"}
{"status":"success","message":"Request received"}

CREATE CONTACT GROUP

Parameter
action = creategroup
apikey = {available on your settings page}
groupname = {your group name}
contacts = {phone numbers separated by comma e.g. 08139235588,08135534866}

$postRequest = array(
    'action' => 'creategroup',
    'apikey' => '62a1c7a4f403f0f1ab773eaa36cc2e01',
	'groupname' => 'My friends',
	'contacts' => '08132980919,08135534866,08139235588'	
);

$cURLConnection = curl_init('https://smsxenda.com/api/');
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);

$apiResponse = curl_exec($cURLConnection);
curl_close($cURLConnection);

// $apiResponse - available data from the API request
echo $apiResponse;

	

RESPONSE

{"status":"success","message":"Contact group created","groupid":"gc_yueuiuu"}
{"status":"failed","message":"Contact group must have at least one number"}

GET ALL GROUPS

Parameter
action = getallgroups
apikey = {available on your settings page}

$postRequest = array(
    'action' => 'getallgroups',
    'apikey' => '62a1c7a4f403f0f1ab773eaa36cc2e01',
);

$cURLConnection = curl_init('https://smsxenda.com/api/');
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);

$apiResponse = curl_exec($cURLConnection);
curl_close($cURLConnection);

echo $apiResponse;

	

RESPONSE

{
    "status": "success",
    "message": "Operation successful",
    "groups": [
        {
            "groupid": "sm_278728",
            "groupname": "Friends"
        },
        {
            "groupid": "sm_22123x",
            "groupname": "Family"
        },
        {
            "groupid": "sm_13bdbnd",
            "groupname": "My new customers"
        }
    ]
}
{"status":"failed","message":"Contact group not found"}

GET GROUP CONTACTS

Parameter
action = getgroupcontacts
apikey = {available on your settings page}
groupid = {your group id}

$postRequest = array(
    'action' => 'getgroupcontacts',
    'apikey' => '62a1c7a4f403f0f1ab773eaa36cc2e01',
	'groupid' => 'sm_12uuiu'
);

$cURLConnection = curl_init('https://smsxenda.com/api/');
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);

$apiResponse = curl_exec($cURLConnection);
curl_close($cURLConnection);

echo $apiResponse;

	

RESPONSE

{"status":"success","message":"Operation successful","groupname":"Friends", "contacts":"08139235588,08135534866"}
{"status":"failed","message":"Contact group not found"}

UPDATE GROUP CONTACTS

This will replace the existing the contacts with the new ones that is provided via the API.

Parameter
action = updategroupcontacts
apikey = {available on your settings page}
groupid = {your group id}
contacts = {08132980919,08135534866,08139235588}

$postRequest = array(
    'action' => 'updategroupcontacts',
    'apikey' => '62a1c7a4f403f0f1ab773eaa36cc2e01',
	'groupid' => 'sm_12uuiu',
	'contacts' => '08132980919,08135534866,08139235588'
);

$cURLConnection = curl_init('https://smsxenda.com/api/');
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);

$apiResponse = curl_exec($cURLConnection);
curl_close($cURLConnection);

echo $apiResponse;

	

RESPONSE

{"status":"success","message":"Operation successful"}
{"status":"failed","message":"Contact group not found"}

Do you have enquiries? Please contact us here