Send 2way SMS Request

Parameter Name Mandatory Type Description
project Yes String The name of the project that owns the apiKey making this request.
from Yes String This is the Shortcode sender defined in your project. This must be registered and
to Yes String A recipient phone number. Define the messages destination in the international mobile number format .E164 e.g "25472xx64287".   NB: talkzuri API will attempt to format your numbers accordingly eg.0722-503-129 is formatted to 254722503129
campaign No String Name of the campaign you are sending the message for.
channel No String premium. Define the channel you wish to send your message with.
message Yes String Content of the message to be sent
type No String 2way
apiKey - String The Project API Key. NB: Instead of having the apiKey in the body, it can alternatively be added as the Value of an Authorization header Bearer token instead. See its use in the Request header HERE
linkId Yes String This ID is generated when a user requests for an 2way service. This parameter is mandatory while delivering content for 2way services.

Response FROM Sozuri OmniChannel API (synchronous)

The body of the response will be a JSON object containing the following fields:
Parameter Name Type Description
messageData String The eventual result of the sms request. It contains the count of sms: >
recipients String A list of recipients that you included in the request. Each recipient is a Map with the following fields
messageId String This is the unique talkzuri message ID returned in the response after the message is successfully accepted
to String This is the recipient’s phone number
status String Description of the status code eg. accepted, unknown_number. This is not indicative of the delivery status of the message.
statusCode String Unique code for the status (see Status Code table for details)
messagePart String This is the nuber of Full text messages. A Full message is made up of 160 characters.
type String 2way

Sample POST 2way 2way SMS Request

POST /api/v1/premium HTTP/1.1
Authorization: Bearer LOx5JPdqf0lvf.......R9X9XDJ4PFxRqVrt9dx83cWiwfTQMF
Content-Type: application/json
Accept: application/json
    "project":"my project",
    "campaign":"Promo Nai",
    "message":"Test SMS.",
    "type": "2way",
    "linkId": "54785454"
    "keyword": "Omoka"


POST /api/v1/premium   HTTP/1.1
Authorization: Bearer LOx5JPdqf0lvf45EZAQMJ.......SUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF
Content-Type: application/json
Accept: application/xml
    <project>my project</project>
    <campaign>Promo nai</campaign>
    <message>Test SMS.</message>



$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "",
    CURLOPT_POSTFIELDS => "{ \"project\":\"my project\",\"from\":\"253145\",\"to\":\"2547251642xx\",
\"campaign\":\"Promo nai\",\"channel\":\"2way\",\"message\":\"Test SMS.\",\"type\":\"2way\",\"linkId\":\"234542\",\"keyword\":\"Omoka\" }",
    "accept: application/json",
    "authorization: Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF",
    "content-type: application/json"

$response = curl_exec($curl);
$err = curl_error($curl);


if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;

var data = JSON.stringify({
    "project":"my project",
    "campaign":"Promo Nai",
    "message":"Test SMS.",
    "type": "2way",
    "linkId": "54785454",
    "keyword": "Omoka"

var xhr = new XMLHttpRequest();
xhr.withCredentials = false;

xhr.addEventListener("readystatechange", function () {
    if (this.readyState === this.DONE) {
});"POST", "",);
xhr.setRequestHeader("authorization", "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "application/json");


require 'uri'
require 'net/http'

url = URI("")

http =, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request =
request["authorization"] = 'Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF'
request["content-type"] = 'application/json'
request["accept"] = 'application/json'

request.body = "{\"project\":\"my project\",\"from\":\"254654\",\"to\":\"2547251642xx\",
\"campaign\":\"Promo nai\",\"channel\":\"2way\",\"message\":\"Test SMS.\",\"type\":\"2way\",\"linkId\":\"234542\",\"keyword\":\"Omoka\"}"

response = http.request(request)
puts response.read_body

conn = http.client.HTTPSConnection("")

payload = "{\"project\":\"my project\",\"from\":\"231254\",\"to\":\"2547251642xx\",
\"campaign\":\"Promo nai\",\"channel\":\"2way\",\"message\":\"Test SMS.\",\"type\":\"2way\",\"linkId\":\"234542\",\"keyword\":\"Omoka\"}"

headers = {
    'authorization': "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF",
    'content-type': "application/json",
    'accept': "application/json"

conn.request("POST", "/api/v1/premium", payload, headers)

res = conn.getresponse()
data =


HttpResponse<String> response ="")
    .header("authorization", "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF")
    .header("content-type", "application/json")
    .header("accept", "application/json")
    .body("{\"project\":\"my project\",\"from\":\"Sozuri\",\"to\":\"2547251642xx\",
\"campaign\":\"Promo nai\",\"channel\":\"2way\",\"message\":\"Test SMS.\",\"type\":\"2way\",\"linkId\":\"234542\",\"keyword\":\"Omoka\"}")

var client = new RestClient("");
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\":\"21254\",\"to\":\"2547251642xx\",
\"campaign\":\"Promo nai\",\"channel\":\"2way\",\"message\":\"Test SMS.\",\"type\":\"2way\",\"linkId\":\"234542\",\"keyword\":\"Omoka\"}", 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",
    "campaign":"Promo Nai",
    "message":"Test SMS.",
    "type": "2way"

HTTP/1.1 200 OK
Content-Type: application/json
    "Result": [
            "messageId": "TZ5DBC6504A7243",
            "credits": 1,
            "number": "+2547251642xx",
            "status": "Success",
            "statusCode": "Hello World."



Synchronous JSON Response

    "messageData": {
        "messages": 2
    "recipients": [
            "messageId": "MSGBLK6012A7E8B90A21611835368",
            "to": "2547251642xx",
            "status": "accepted",
            "statusCode": "11",
            "message": "Omoka",
            "messagePart": 1,
            "type": "2way"
Sent whenever a message is sent to any of your registered shortcodes, We will asynchronously send a notification to your callback for that 2way sms service with the respective linkId for sending back a reply to the subscriber.

Receive Message Callback to your webhook

    "message":"Hello, what is the location of your Nairobi office",
    "messageId": "SMSGkjiPkX78654kls",
    "channel": "interactive",
    "status": "success",
    "network": "safaricom",
    "type": "interactive",
    "timestamp": "1603713484"
Setting a username & password on callback (Optional Authentication)

It is possible to predefine an Auth Key for your message callbacks. This value will then be included as parameters in the body to allow your system to authenticate that the request is indeed from Sozuri.