Sample code to get you started in minutes!
The base URL for all API call strings is: https://sozuri.net/api/v1/messaging
One-way messaging: Request headers
POST /api/v1/messaging Content-Type: application/json Authorization: Bearer Your_Project_API_KEY
One-way messaging: Sample GET Request
https://sozuri.net/api/v1/messaging?apiKey=Your_Project_API_KEY&project=Your_Project_name&from=MyShortcode&to=254722xxx675&campaign=Nai-Promo&channel=sms&message=TalkzuriTestSMS&type=promotional
Sample POST Request
POST /api/v1/messaging HTTP/1.1
Host: sozuri.net
Authorization: Bearer LOx5JPdqf0lvf.......R9X9XDJ4PFxRqVrt9dx83cWiwfTQMF
Content-Type: application/json
Accept: application/json
{
"project":"my project",
"from":"Sozuri",
"to":"2547251642xx,2547326971xx",
"campaign":"Promo Nai",
"channel":"sms",
"message":"Test SMS.",
"type": "promotional"
}
POST /api/v1/messaging HTTP/1.1
Host: sozuri.net
Authorization: Bearer LOx5JPdqf0lvf45EZAQMJ.......SUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF
Content-Type: application/json
Accept: application/xml
<request>
<project>my project</project>
<from>Sozuri</from>
<to>2547251642xx,2547326971xx</to>
<campaign>Promo nai</campaign>
<channel>sms</channel>
<message>Test SMS.</message>
<type>promotional</type>
</request>
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sozuri.net/api/v1/messaging",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"project\":\"my project\",\"from\":\"Sozuri\",\"to\":\"2547251642xx,2547326971xx\",
\"campaign\":\"Promo nai\",\"channel\":\"sms\",\"message\":\"Test SMS.\",\"type\":\"promotional\" }",
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF",
"content-type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var data = JSON.stringify({
"project":"my project",
"from":"Sozuri",
"to":"2547251642xx,2547326971xx",
"campaign":"Promo Nai",
"channel":"sms",
"message":"Test SMS.",
"type": "promotional"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://sozuri.net/api/v1/messaging",);
xhr.setRequestHeader("authorization", "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "application/json");
xhr.send(data);
require 'uri'
require 'net/http'
url = URI("https://sozuri.net/api/v1/messaging")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["authorization"] = 'Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF'
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{\"project\":\"my project\",\"from\":\"Sozuri\",\"to\":\"2547251642xx,2547326971xx\",
\"campaign\":\"Promo nai\",\"channel\":\"sms\",\"message\":\"Test SMS.\",\"type\":\"promotional\"}"
response = http.request(request)
puts response.read_body
conn = http.client.HTTPSConnection("sozuri.net")
payload = "{\"project\":\"my project\",\"from\":\"Sozuri\",\"to\":\"2547251642xx,2547326971xx\",
\"campaign\":\"Promo nai\",\"channel\":\"sms\",\"message\":\"Test SMS.\",\"type\":\"promotional\"}"
headers = {
'authorization': "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF",
'content-type': "application/json",
'accept': "application/json"
}
conn.request("POST", "/api/v1/messaging", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.post("https://sozuri.net/api/v1/messaging")
.header("authorization", "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF")
.header("content-type", "application/json")
.header("accept", "application/json")
.body("{\"project\":\"my project\",\"from\":\"Sozuri\",\"to\":\"2547251642xx,2547326971xx\",
\"campaign\":\"Promo nai\",\"channel\":\"sms\",\"message\":\"Test SMS.\",\"type\":\"promotional\"}")
.asString();
var client = new RestClient("https://sozuri.net/api/v1/messaging");
var request = new RestRequest(Method.POST);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF");
request.AddParameter("application/json", "{ \"project\":\"my project\",\"from\":\"Sozuri\",\"to\":\"2547251642xx,2547326971xx\",
\"campaign\":\"Promo nai\",\"channel\":\"sms\",\"message\":\"Test SMS.\",\"type\":\"promotional\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
curl -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF' \
-d '{
"project":"my project",
"from":"Sozuri",
"to":"2547251642xx,2547326971xx",
"campaign":"Promo Nai",
"channel":"sms",
"message":"Test SMS.",
"type": "promotional"
}' https://sozuri.net/api/v1/messaging
HTTP/1.1 200 OK
Content-Type: application/json
{
"Result": [
{
"tzId": "TZ5DBC6504A7243",
"credits": 1,
"number": "+2547251642xx",
"status": "Success",
"statusCode": "Hello World lucy."
},
{
"wzId": "TZ5DBC6504A7289",
"sms_credits": 1,
"to": "+2547326971xx",
"status": "Success",
"message": "Hello World John."
}
]
}
JSON Response
{ "messageData": { "messages": 2 }, "recipients": [ { "messageId": "MSGBLK6012A7E8B90A21611835368", "to": "2547251642xx", "status": "accepted", "statusCode": "11", "bulkId": "bulk6012a7e8b904e1611835368", "messagePart": 1, "type": "promotional" }, { "messageId": "MSGBLK6012A7E8B90A41611835368", "to": "2547326971xx", "status": "accepted", "statusCode": "11", "bulkId": "bulk6012a7e8b904e1611835368", "messagePart": 1, "type": "promotional" } ] }