# SMS

Bonga sends SMS through managed carrier routes, Android gateway devices, or a configured legacy provider.

## Managed SMS

Managed SMS is the recommended path for business messaging in supported countries.

1. **Check coverage and pricing.** `GET /api/v1/sms/catalog` lists countries, telcos and rates. The dashboard shows the same catalog under **Channels → SMS**.
2. **Request a sender ID.** Some countries require registration and approval. Track it in **Dashboard → Sender IDs** or the managed sender routes.
3. **Quote before sending.** `POST /api/v1/sms/quote` returns the price for a destination, sender and message.
4. **Send.** `POST /api/v1/sms/send` accepts one or many recipients.
5. **Track.** Use the batch ID with `GET /api/v1/sms/batches/{id}` and `GET /api/v1/sms/batches/{id}/messages`, or the per-message report route.

Managed sends are billed from the workspace wallet. Pricing is per segment; a long message counts as multiple segments. A failed or rejected recipient does not charge for that recipient.

```bash
curl -X POST 'https://api.bonga.africa/api/v1/sms/send' \
  -H "Authorization: Bearer $BONGA_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: dispatch-771' \
  --data '{
    "phoneNumber": "+254712345678",
    "message": "Your parcel is out for delivery.",
    "senderID": "BONGA"
  }'
```

The legacy managed contract requires `sms:send`. Reports require `sms:read`; cancellation requires `sms:cancel`.

## Scheduling

Scheduled managed SMS is part of the v2 messaging contract: `POST /api/v2/messages/scheduled`. It requires a ready managed sender and the scheduling rollout flag. The sender, consent and opt-out state are rechecked at dispatch, and a cancel does not return the daily key quota.

## Android gateway

The Android gateway turns a phone into an SMS sender:

1. Install the Bonga gateway APK and pair it with a short code from **Dashboard → Channels → Android**.
2. The device reports its SIMs and stays connected by polling with optional push wake-up.
3. Send through the device sender or the v2 contract once the sender is ready.

Delivery depends on the device being online, having signal and having SMS credit. Use it where you control the SIM and volume is moderate.

## Legacy provider

A workspace can configure its own SMS provider. This path is kept for compatibility with existing integrations. New work should prefer managed SMS or v2 messaging.

## Inbound SMS and USSD

Gateway devices report inbound messages and USSD sessions. They land in the inbox and are available to automations. USSD request and response payloads are exposed under `/api/v1/sms/ussd`.

## Best practices

- Register sender IDs early; approval can take days.
- Keep messages under 160 GSM-7 characters or 70 UCS-2 characters to avoid extra segments.
- Store the batch ID; individual recipients can diverge.
- Respect opt-outs and quiet hours for marketing.
- Prefer v2 for new integrations; it has a stable acceptance and status contract.

## Next

- [Managed SMS](/docs/managed-sms)
- [Managed SMS API guide](/guides/managed-sms-api)
- [Messaging API v2](/docs/messaging-api-v2)
