Bonga Messaging API v2
Find a sender in your workspace and track messages accepted by the API. Submission is in preview and does not deliver to a provider.
Authentication
Set Authorization: Bearer YOUR_API_KEY on every request. Use messages:read for discovery and tracking, and messages:send for submission. Store the key on your server.
Base URL: http://localhost:8080
curl 'http://localhost:8080/api/v2/senders?channel=sms' \
-H "Authorization: Bearer $BONGA_API_KEY" The response includes data.senders and data.connections. Change channel to whatsapp or email to list those senders.
Choose a sender
Match sender.connection_id to connections[].id. Use a ready sender’s snd_… ID as from and pick one of its content_types. A configured sender marked not_qualified cannot accept preview submissions.
- SMS: Pick a managed identity or match the Android gateway and its reported SIM slot.
- WhatsApp: Pick a linked session for text or a business number and approved template for Cloud WhatsApp.
- Email: Pick a verified From address.
SMS, WhatsApp, WABA, and email
Each example uses POST /api/v2/messages in preview. Replace from with a ready sender ID from discovery. Requests accept one recipient and do not deliver to providers in the current preview.
SMS: managed sender or Android SIM
Use a managed sender ID, or choose the sender for the intended Android device and SIM slot. The request is the same.
{
"channel": "sms",
"from": "snd_example01",
"to": "+254712345678",
"content": {
"type": "text",
"text": "Your order is ready."
}
}WhatsApp: linked device
Choose a sender on a linked_whatsapp connection. This preview example uses free-form text.
{
"channel": "whatsapp",
"from": "snd_example02",
"to": "+254712345678",
"content": {
"type": "text",
"text": "Your order is ready."
}
}WhatsApp Business API (WABA)
Choose a business number on a cloud_whatsapp connection. Supply a Bonga template ID approved for that number.
{
"channel": "whatsapp",
"from": "snd_example03",
"to": "+254712345678",
"content": {
"type": "template",
"template_id": "order_ready"
}
}Choose a verified From address. Provide a subject and at least one of text or html.
{
"channel": "email",
"from": "snd_example04",
"to": "customer@example.com",
"content": {
"type": "email",
"subject": "Order ready",
"text": "Your order is ready.",
"html": "<p>Your order is <strong>ready</strong>.</p>"
}
}Submit an email with cURL
First list senders with GET /api/v2/senders?channel=email and a key with messages:read. For submission, use messages:send and replace the example from with the ID of a ready email sender. Supply a subject and either a plain-text or HTML body, or both.
curl -i 'http://localhost:8080/api/v2/messages' \
-H "Authorization: Bearer $BONGA_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: order-4821-email' \
--data '{
"channel": "email",
"from": "snd_example04",
"to": "customer@example.com",
"content": {
"type": "email",
"subject": "Order ready",
"text": "Your order is ready.",
"html": "<p>Your order is <strong>ready</strong>.</p>"
}
}'202 Accepted records the message. Use its Location to track it. Preview submission does not deliver to a mailbox. There is no public SMTP submission endpoint or selectable email stream in v2.
Read email sending limits with email:limits:read to check your plan cap, counted usage, remaining allowance, and next UTC reset. An uncapped plan does not guarantee provider capacity or available funds.
Bulk, contacts, and campaigns
These features are available in the dashboard where enabled. Public v2 does not currently provide endpoints for them.
Which endpoint should I use?
- List senders
messages:read - List connections
messages:read - Submit a message
messages:send - Track a message
messages:read - Read email sending limits
email:limits:read
The preview accepts one recipient per request. Bulk sends, personalized bulk, and scheduling are not available through public v2.
Tracking, retries, and delivery
Submit a message with a unique Idempotency-Key. Reuse that key and the same payload on retry. A 202 Accepted returns a Location you can use to track it with messages:read. A queued message is recorded but has not been sent. Check the operation’s response section for error codes.
- Your reference:
- Keep your order or job ID in your own system and save the returned
data.idalongside it. Public v2 does not accept a client reference. - Message ID:
- Use the message ID in
Locationto look up status. - Idempotency key:
- Use it to retry submission. It cannot be used to look up a message.
Replace the sample path with the Location from your submission.
curl 'http://localhost:8080/api/v2/messages/msg_0123456789abcdef' \
-H "Authorization: Bearer $BONGA_API_KEY" Poll the status endpoint in this preview. Customer delivery webhooks are not available through public v2. A sent status means confirmed provider submission; delivered requires a receipt. submission_unknown means the provider may have accepted the message. Keep tracking the existing message and avoid an automatic resend.
Credits and billing
Segments count the parts of an SMS. Units or credits are prepaid allowances. Wallet balances and charges are money in a named currency.
Use the wallet to check your balance, review transactions, or add funds. Use credits to purchase prepaid units from the wallet where enabled. These actions are not public v2 endpoints. Preview submissions do not return segment counts, quotes, or charges.