Two-way SMS lets your application both send messages to a customer and receive their reply — perfect for conversational support, surveys, menus and SMS-driven workflows on any feature phone.

How it works

  1. Customers text your shortcode. Messages from Safaricom and Airtel subscribers are received.
  2. Sozuri forwards each message to your Inbound Messages callback URL as a JSON POST, as it arrives.
  3. You reply with the standard Send SMS endpoint, using your shortcode as the from.
Two-way SMS requires an approved shortcode. Request one in your project from 2 Way SMS › Request Shortcode. Approval typically takes 5–10 business days.

Sending the reply

Two-way and one-way SMS share the same request format. Use the Send SMS endpoint with your shortcode as the from field. Like any sender ID, the shortcode must be registered to your project, exactly as written, for the recipient’s network and the type you send; a recipient on a network where it is not registered comes back as sender_not_registered and is not charged.

There is no separate two-way send endpoint. /api/v1/messaging/2way is an older alias of the premium send endpoint: it sends a charged premium message and only works for a premium service. Do not use it for ordinary replies.

Receiving messages

When a customer texts your shortcode, Sozuri POSTs the message to your Inbound Messages callback URL — the Inbox URL under Manage API › Callback URLs. It may be a comma-separated list; each URL receives its own copy.

The request looks like this:

POST https://your-app.example/sozuri/incoming
Content-Type: application/json
Accept: application/json
X-Sozuri-Signature: t=1762560000,v1=<hex hmac_sha256(signing_secret, "1762560000." + raw_body)>

{
    "project": "my project",
    "number": "254700000001",
    "shortcode": "20000",
    "message": "Hello, where is your Nairobi office?",
    "messageId": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2",
    "channel": "interactive",
    "status": "success",
    "network": "safaricom",
    "type": "interactive",
    "timestamp": 1762560000,
    "authKey": "szk_YOUR_AUTH_KEY"
}
FieldTypeDescription
projectStringYour project’s name.
numberStringThe customer who sent the message, as the network reports the number.
shortcodeStringThe shortcode they texted.
messageStringThe text they sent.
messageIdStringSozuri’s id for this inbound message (40 hexadecimal characters).
channel, typeStringAlways interactive.
statusStringAlways success.
networkStringsafaricom or airtel.
timestampNumberUnix time, in seconds, when Sozuri sent the webhook.
authKeyStringYour project’s Auth Key, always the last field — see below.
  • One attempt. Each message is sent to your URL once, as it arrives, and is not retried if your server is down or answers with an error. Every inbound message is also saved to your project, so you can still see it in the dashboard.
  • Enforce HTTPS. If it is ticked on your callback configuration, a plain http:// URL is not called at all.
  • Test it. Test Inbox next to the URL on the Callback URLs page sends a signed sample. A test carries "test": true and a messageId starting sozuri_test_.
  • Automatic replies. If you have switched on keyword replies or the AI agent under AI Automation, they can also answer the message. Their replies are ordinary, billed SMS.

Callback authentication

Every inbound callback carries your project’s Auth Key in the body as authKey, plus an X-Sozuri-Signature HMAC header over the raw body, so your server can confirm the request really came from us. Find both under Manage API › Callback URLs › Webhook security — see Verifying authenticity.

Use cases

Two-way SMS is the most universal channel in Kenya. Here’s how teams use it.

Customer support without an app

Let customers text your shortcode for help — works on every phone, no data needed.

S
20000
Support
Hi, where is your Nairobi office? 09:12
We’re at Westlands, Sarit Centre, 2nd floor. Open 9–5 Mon–Fri. Karibu! 09:12

SMS surveys & voting

Run polls, NPS surveys and audience voting on any device — ideal for media and field research.

V
20001
Vote
Who deserves Artist of the Year? Reply 1 for Sauti Sol, 2 for Nyashinski. 20:00
2 20:01

Lead capture & signup

Advertise a shortcode on radio or billboards. Anyone who texts a keyword becomes a qualified lead in your CRM.

L
20002
Loan
LOAN 11:45
Karibu! Reply with your full name and ID number to apply for a loan up to KES 50,000. 11:45

Build a conversation, not a broadcast.

Apply for a shortcode and start receiving replies in your application within minutes of approval.