Messaging API v2

The v2 API is one contract across WhatsApp, SMS and email: discover a sender, submit one message, track it. It replaces per-channel endpoint families for new integrations.

Note. Preview scope. Most v2 sends are a preview contract until their route is qualified. A queued message is recorded but may not reach a provider. Read the qualification note on each channel before production traffic, and keep v1 where your channel is not yet qualified.

Discover

curl 'https://api.bonga.africa/api/v2/senders?channel=email' \
  -H "Authorization: Bearer $BONGA_API_KEY"

The response contains senders and connections. Match sender.connection_id to a connection. A sender is usable only when ready is true and it lists the content type you need. A configured sender with readiness_reason: not_qualified is deliberately visible but cannot submit.

FieldUse
idOpaque snd_… value; send this as from
channelsms, whatsapp or email
typeSender family, for example sim, linked_whatsapp, cloud_whatsapp, managed, smtp
content_typesWhat the sender can carry
can_scheduleManaged SMS scheduling is enabled for it

Submit

curl -X POST 'https://api.bonga.africa/api/v2/messages' \
  -H "Authorization: Bearer $BONGA_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: order-4821' \
  --data '{
    "channel": "sms",
    "from": "snd_example01",
    "to": "+254712345678",
    "content": { "type": "text", "text": "Your order is ready." }
  }'
  • One recipient per request.
  • purpose defaults to transactional.
  • The JSON body is limited to 32 KiB.
  • A 202 returns a message ID and a Location header.
  • A retry with the same key and payload returns the original message and Idempotent-Replay: true.

Content

ChannelContent
SMStext
WhatsApp linkedtext
WhatsApp Cloudtext inside the service window, or template with a Bonga template ID
Emailemail with subject and text and/or html

Email requires at least one non-empty body. WhatsApp templates must be approved for the number.

Track

curl 'https://api.bonga.africa/api/v2/messages/msg_0123456789abcdef' \
  -H "Authorization: Bearer $BONGA_API_KEY"

Status is evidence-based: queued, sent, delivered, read, failed or submission_unknown. A sent status means confirmed provider submission, not delivery. submission_unknown means the provider may have accepted it; reconcile instead of resending.

Schedule

Managed SMS can be scheduled:

curl -X POST 'https://api.bonga.africa/api/v2/messages/scheduled' \
  -H "Authorization: Bearer $BONGA_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: appointment-556' \
  --data '{
    "channel": "sms",
    "from": "snd_example01",
    "to": "+254712345678",
    "content": { "type": "text", "text": "Your appointment is tomorrow." },
    "send_at": "2027-01-15T09:00:00Z"
  }'

send_at is one minute to 365 days ahead. The sender, consent and opt-out state are rechecked at dispatch. Cancelling does not refund the daily key quota.

Errors

Every refusal carries a stable error code. Common ones:

CodeMeaning
INVALID_REQUESTMalformed or missing field
INVALID_SENDERSender does not belong to the workspace
SENDER_NOT_READYSender is configured but not qualified
CONTENT_UNQUALIFIEDContent type is not available for the sender
TEMPLATE_UNQUALIFIEDTemplate is not approved for the number
INTENT_REFUSEDPurpose or consent policy refused
IDEMPOTENCY_CONFLICTSame key, different payload
CHANNEL_UNQUALIFIEDChannel is not open for this workspace

What v2 does not do

Bulk sends, contacts, campaigns, inbox and automation are dashboard features; v2 does not expose them yet. Use v1 or the dashboard for those, and keep one integration per concern.

Next