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.
| Field | Use |
|---|---|
id | Opaque snd_… value; send this as from |
channel | sms, whatsapp or email |
type | Sender family, for example sim, linked_whatsapp, cloud_whatsapp, managed, smtp |
content_types | What the sender can carry |
can_schedule | Managed 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.
purposedefaults totransactional.- The JSON body is limited to 32 KiB.
- A
202returns a message ID and aLocationheader. - A retry with the same key and payload returns the original message and
Idempotent-Replay: true.
Content
| Channel | Content |
|---|---|
| SMS | text |
| WhatsApp linked | text |
| WhatsApp Cloud | text inside the service window, or template with a Bonga template ID |
email 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:
| Code | Meaning |
|---|---|
INVALID_REQUEST | Malformed or missing field |
INVALID_SENDER | Sender does not belong to the workspace |
SENDER_NOT_READY | Sender is configured but not qualified |
CONTENT_UNQUALIFIED | Content type is not available for the sender |
TEMPLATE_UNQUALIFIED | Template is not approved for the number |
INTENT_REFUSED | Purpose or consent policy refused |
IDEMPOTENCY_CONFLICT | Same key, different payload |
CHANNEL_UNQUALIFIED | Channel 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.