Skip to content
For developers

Send a WhatsApp message from your own system.

One request sends a message. A test key checks everything a live key checks, then stops: nothing is sent, nothing is charged, and no WhatsApp number needs to be connected yet.

curl https://sema.datacare.co.ke/api/v1/messages \
  -H "Authorization: Bearer $SEMA_KEY" \
  -H "Idempotency-Key: order-4171" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "254799999002",
    "type": "text",
    "text": { "body": "Your order is ready for collection." }
  }'
{
  "id": "0b1c25a4-33e7-414a-b413-0c492fb50a4a",
  "status": "queued",
  "to": "254799999002",
  "type": "text",
  "created_at": "2026-09-22T19:23:06.938Z"
}

With a test key, the number 254799999002 comes back read. 254799999001 fails, 254799999003 is refused because the reply window is closed, 254799999004 is refused for low credit and 254799999005 is refused because that person opted out. Any other number comes back delivered.

Start in three steps

  1. Make a test key in Settings, API keys, as an owner or admin.
  2. Send to the number that comes back read, and handle each outcome above.
  3. Connect your WhatsApp number, make a live key, and swap it in.

Keys and scopes

Each key is made for one system and ticks only what that system needs: sending, reading, contacts, templates, one-time codes, webhooks, campaigns or what the AI answers from. A key is shown once and stored only as a hash. Each has its own limit of requests a minute. Keys in the reference.

Test keys and live keys

Every response says "mode": "test" or "mode": "live", so your integration can refuse to start with the wrong kind. A test key cannot read your real customers.

Retries that never send twice

Every send carries an Idempotency-Key. Send the same key with the same body and you get the first answer back. Send it with a different body and you get a 409. A key is remembered for seven days. Sending in the reference.

Many at once

Check the balance first, then send a batch in one request. Batches in the reference.

One-time codes

Confirm a phone number at checkout or sign-in. Sema makes a six-digit code, sends it through your approved authentication template and tells you whether the code your customer typed is right. A code lasts ten minutes, five wrong tries kill it, and nobody at your business can read it. With a test key the code is always 000000. One-time codes in the reference.

Signed webhooks

Rather than asking what happened, be told. Each delivery carries a sema-signature header you check with your signing secret. There are 15 events:

  • message.receivedA customer sent you a message
  • message.deliveredA message you sent reached the phone
  • message.readThey read it
  • message.failedIt could not be delivered
  • contact.opted_outSomebody asked to stop hearing from you
  • payment.receivedA customer paid you by M-Pesa from a conversation, confirmed with M-Pesa itself
  • message.sentA message you sent left for WhatsApp
  • template.status_changedMeta approved, rejected, paused or disabled a template
  • deal.createdA deal was added to the pipeline: `data` is the deal
  • deal.stage_changedA deal moved to another stage: `data` is the deal, with `from_stage`
  • deal.wonA deal was won: `data` is the deal
  • deal.lostA deal was lost: `data` is the deal, with its `lost_reason`
  • appointment.bookedAn appointment was booked: `data` is the appointment
  • appointment.changedAn appointment was confirmed, moved, cancelled or marked: `data` is the appointment
  • lead.capturedSema learnt who a customer is, whether or not it made a deal: `data` is {source (lead_form, website_chat or assistant), conversation_id, contact {id, wa_id, name, email}, form {id, name, welcomed}, asked, page}

Webhooks in the reference.

OpenAPI

The whole API is described at /api/v1/openapi.json. Point Postman, Insomnia or your own generator at it. A test fails if the file stops matching the routes. A TypeScript client, @sema/client, is built from it but is not on npm yet, so until it is, generate your own from the file.

MCP, for AI assistants

Sema has an MCP server at https://sema.datacare.co.ke/api/mcp. An assistant works with the same key and the same scopes, is offered only the tools those scopes allow and asks you before it sends or starts anything. Connecting an assistant.

Zapier, Make, n8n and other tools

A webhook or an HTTP step in the tool can send and receive through Sema with an API key. Sema’s own Zapier and n8n apps are not published yet. All integrations.

What it costs

Each message is charged at one all-in price, the same as one sent from the inbox. Work out your own month.