import http.client
import json
conn = http.client.HTTPSConnection("portal.zepsonsms.co.tz")
payload = json.dumps({
"from": "ZEPSONSMS",
"to": [
"255654485755",
"255752771650"
],
"text": "this is the text message"
})
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
conn.request("POST", "/api/v3/sms/send?recipient=255654485755,255752771650&sender_id=ZEPSONSMS&message=Test%20Message&type=plain", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://portal.zepsonsms.co.tz/api/v3/sms/send?recipient=255654485755,255752771650&sender_id=ZEPSONSMS&message=Test%20Message&type=plain',
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{"from":"ZEPSONSMS", "to":["255654485755", "255752771650"], "text": "this is the text message"}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var settings = {
"url": "https://portal.zepsonsms.co.tz/api/v3/sms/send?recipient=255654485755,255752771650&sender_id=ZEPSONSMS&message=Test Message&type=plain",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
"data": JSON.stringify({
"from": "ZEPSONSMS",
"to": [
"255654485755",
"255752771650"
],
"text": "this is the text message"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
var headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
};
var request = http.Request('POST', Uri.parse('https://portal.zepsonsms.co.tz/api/v3/sms/send?recipient=255654485755,255752771650&sender_id=ZEPSONSMS&message=Test Message&type=plain'));
request.body = json.encode({
"from": "ZEPSONSMS",
"to": [
"255654485755",
"255752771650"
],
"text": "this is the text message"
});
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
var axios = require('axios');
var data = JSON.stringify({
"from": "ZEPSONSMS",
"to": [
"255654485755",
"255752771650"
],
"text": "this is the text message"
});
var config = {
method: 'post',
url: 'https://portal.zepsonsms.co.tz/api/v3/sms/send?recipient=255654485755,255752771650&sender_id=ZEPSONSMS&message=Test Message&type=plain',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});