Send text, media, or location message to whatsapp
Whatsapp message
Send a whatsapp message from your WHatsapp Business number to one or more destination.
1. Whatsapp Messages:-
a. A successful response means that a message record has been created in Sozuri. It does not mean that each message was successfully queued, sent or delivered.
To know the status of the message check the parameter status of the message record.
b. Whatsapp Message records might be created with a failed state due issues with Sozuri platform or validation issues. Please check error description to know the reason of the failure.
c. Whatsapp Message records might be updated to state undelivered. This is due to carrier/operator related issues. Please check error description to know the reason of the failure. Balance is still deducted for such cases.
d.Since this is a bulk API
d. Once queued, the messages for your account are dequeued and processed at a rate set for your account (defaults to 5 messages per second). Contact sales to get your rate limit increased. For fair usage, there is no rate limiting for queueing messages using this API. Dequeue rate would still be applicable as stated.
The base URL for all API call strings is: https://sozuri.net/api/v1/whatsapp.
Whatsapp messaging: Request headers
POST /api/v1/whatsappS Content-Type: application/json Authorization: Bearer Your_Project_API_KEY
Sample POST Send Message Request
POST /api/v1/messaging HTTP/1.1
Host: sozuri.net
Authorization: Bearer LOx5JPdqf0lvf.......R9X9XDJ4PFxRqVrt9dx83cWiwfTQMF
Content-Type: application/json
Accept: application/json
{
"project": "andiva",
"from": "+254746482072",
"to": "+254725164293",
"campaign":"Promo Nai",
"channel": "whatsapp",
"message": "Hello Team Sozuri 14 49",
"type": "conversation",
"contentType": "location",
"longitude": "12",
"latitude":"10",
"label": "My Big Shop",
"address": "Nairobi",
"mediaUrl": "https://image.shutterstock.com/image-illustration/beautiful-aurora-universe-milky-way-260nw-1787056478.jpg",
"mediaCaption": "Ohw, isnt it Beautiful",
"apiKey": "8LrAtFCp1gBFb05 b3G3NLsEvoBAEnbCjILJ0i"
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sozuri.net/api/v1/whatsapp',
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 =>'{ "project": "andiva",
"from": "+254746482072",
"to": "+254725164293",
"campaign":"Promo Nai",
"channel": "whatsapp",
"message": "Hello Team Sozuri 14 49",
"type": "conversation",
"contentType": "location",
"longitude": "12",
"latitude":"10",
"label": "My Big Shop",
"address": "Nairobi",
"mediaUrl": "https://image.shutterstock.com/image-illustration/beautiful-aurora-universe-milky-way-260nw-1787056478.jpg",
"mediaCaption": "Ohw, isnt it Beautiful",
"apiKey": "8LrAtFCp1gBFb05...b3G3NLsEvoBAEnbCjILJ0i"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
': '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var data = JSON.stringify({
"project": "andiva",
"from": "254746482072",
"to": "+254725164293",
"campaign": "Promo Nai",
"channel": "whatsapp",
"message": "Hello Team Sozuri 14 49",
"type": "conversation",
"contentType": "location",
"longitude": "12",
"latitude": "10",
"label": "My Big Shop",
"address": "Nairobi",
"mediaUrl": "https://image.shutterstock.com/image-illustration/beautiful-aurora-universe-milky-way-260nw-1787056478.jpg",
"mediaCaption": "Ohw, isnt it Beautiful",
"apiKey": "8LrAtFCp1gBFb05...b3G3NLsEvoBAEnbCjILJ0i"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://sozuri.net/api/v1/whatsapp");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("", "");
xhr.send(data);
require "uri"
require "json"
require "net/http"
url = URI("https://sozuri.net/api/v1/whatsapp")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request[""] = ""
request.body = JSON.dump({
"project": "andiva",
"from": "254746482072",
"to": "+254725164293",
"campaign": "Promo Nai",
"channel": "whatsapp",
"message": "Hello Team Sozuri 14 49",
"type": "conversation",
"contentType": "location",
"longitude": "12",
"latitude": "10",
"label": "My Big Shop",
"address": "Nairobi",
"mediaUrl": "https://image.shutterstock.com/image-illustration/beautiful-aurora-universe-milky-way-260nw-1787056478.jpg",
"mediaCaption": "Ohw, isnt it Beautiful",
"apiKey": "8LrAtFCp1gBFb05...b3G3NLsEvoBAEnbCjILJ0i"
})
response = https.request(request)
puts response.read_body
import http.client
import json
conn = http.client.HTTPSConnection("sozuri.net")
payload = json.dumps({
"project": "andiva",
"from": "254746482072",
"to": "+254725164293",
"campaign": "Promo Nai",
"channel": "whatsapp",
"message": "Hello Team Sozuri 14 49",
"type": "conversation",
"contentType": "location",
"longitude": "12",
"latitude": "10",
"label": "My Big Shop",
"address": "Nairobi",
"mediaUrl": "https://image.shutterstock.com/image-illustration/beautiful-aurora-universe-milky-way-260nw-1787056478.jpg",
"mediaCaption": "Ohw, isnt it Beautiful",
"apiKey": "8LrAtFCp1gBFb05...b3G3NLsEvoBAEnbCjILJ0i"
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'': ''
}
conn.request("GET", "/api/v1/whatsapp", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://sozuri.net/api/v1/whatsapp")
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("", "")
.build();
Response response = client.newCall(request).execute();
var client = new RestClient("https://sozuri.net/api/v1/whatsapp");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
request.AddHeader("", "");
var body = @"{ ""project"": ""andiva"",
" + "\n" +
@" ""from"": ""+254746482072"",
" + "\n" +
@" ""to"": ""+254725164293"",
" + "\n" +
@" ""campaign"":""Promo Nai"",
" + "\n" +
@" ""channel"": ""whatsapp"",
" + "\n" +
@" ""message"": ""Hello Team Sozuri 14 49"",
" + "\n" +
@" ""type"": ""conversation"",
" + "\n" +
@" ""contentType"": ""location"",
" + "\n" +
@" ""longitude"": ""12"",
" + "\n" +
@" ""latitude"":""10"",
" + "\n" +
@" ""label"": ""My Big Shop"",
" + "\n" +
@" ""address"": ""Nairobi"",
" + "\n" +
@" ""mediaUrl"": ""https://image.shutterstock.com/image-illustration/beautiful-aurora-universe-milky-way-260nw-1787056478.jpg"",
" + "\n" +
@" ""mediaCaption"": ""Ohw, isnt it Beautiful"",
" + "\n" +
@" ""apiKey"": ""8LrAtFCp1gBFb05...b3G3NLsEvoBAEnbCjILJ0i""
" + "\n" +
@"}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
curl --location --request GET 'https://sozuri.net/api/v1/whatsapp' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{ "project": "andiva",
"from": "+254746482072",
"to": "+254725164293",
"campaign":"Promo Nai",
"channel": "whatsapp",
"message": "Hello Team Sozuri 14 49",
"type": "conversation",
"contentType": "location",
"longitude": "12",
"latitude":"10",
"label": "My Big Shop",
"address": "Nairobi",
"mediaUrl": "https://image.shutterstock.com/image-illustration/beautiful-aurora-universe-milky-way-260nw-1787056478.jpg",
"mediaCaption": "Ohw, isnt it Beautiful",
"apiKey": "8LrAtFCp1gBFb05...b3G3NLsEvoBAEnbCjILJ0i"
}'
JSON Response
{ "messageData": { "messages": 1 }, "recipients": [ { "messageId": "f659b9ba4d9551c39ca61498126da29f68a1c1e9", "from": "+254746482072", "to": "+254725164293", "campaign": null, "channel": "whatsapp", "message": "My Big Shop. Nairobi. Lo:12.La: 10", "type": "conversation", "contentType": "location", "direction": "outbound", "status": "queued", "cost": "n", "description": "business message", "mediaUrl": null, "mediaCaption": null, "mediaType": null, "address": "Nairobi", "longitude": "12", "latitude": "10", "label": "My Big Shop" } ] }