SMS delivery and errors
Check whether a message reached the phone, and interpret delivery states, HTTP status codes and SMS response codes.
A successful send only means Hubtel accepted the message. Check its status with the message ID to find out whether it reached the phone.
Before you start(1)
- SMS API keys
Business SMS Client ID and Client Secret
A sender ID is the name your customers see as the sender of your SMS, such as your business name. Hubtel approves each sender ID, and you create a Client ID and Client Secret for each approved one.
Don't have these yet? Start in the sandbox with your test keys while you set them up.
Save the messageId (and batchId, when returned) from each send. Check delivery with the same credentials you sent with:
| Lookup | Endpoint | Reference |
|---|---|---|
| Message | GET https://sms.hubtel.com/v1/messages/{messageId} | Message status |
| Batch | GET https://sms.hubtel.com/v1/messages/batch/{batchId} | Batch status |
curl https://sms.hubtel.com/v1/messages/03109b26-5be1-444d-8189-9f6fa2b4550a \
-u "$HUBTEL_SMS_CLIENT_ID:$HUBTEL_SMS_CLIENT_SECRET"{ "rate": 0.0309, "batchId": null, "messageId": "03109b26-5be1-444d-8189-9f6fa2b4550a", "content": "Your order is ready for pickup.", "status": "Delivered", "updateTime": "2023-05-30T16:43:15", "time": "2023-05-30T16:43:13.7208383Z", "to": "233249111411", "from": "KofiBooks" }A batch result has the batchId and a data array of message results.
Delivery states
Statuses come from the network operator's delivery receipts.
| State | Meaning |
|---|---|
Delivered | The operator reports delivery to the recipient's phone. |
Sent | Forwarded to the operator; final delivery is still pending. Check again later. |
Pending | Queued at Hubtel before forwarding to the operator. |
Blacklisted | The operator has blocked bulk messages for the recipient, including opt-out cases. |
Undeliverable / Failed, Unrouteable / Error, Rejected | Delivery failed, for example because the phone was off or out of coverage. The exact status depends on the operator. |
NACK / 0x0000000b / Invalid Destination Address | Check the recipient number and formatting. |
NACK / 0x0000000a / Invalid Source Address | Check the sender, including the 11-character limit. |
HTTP and SMS response codes
A 2xx response can still carry a nonzero SMS status, so check both.
| HTTP | SMS status | Meaning |
|---|---|---|
| 200 or 201 | 0 | Accepted for onward delivery; this does not confirm handset delivery. |
| 201 | 100 | Missing data or malformed request. |
| 201 | 1 | Invalid destination address. |
| 201 | 2 | Invalid source address. |
| 400 | 3 | Message body too long. |
| 400 | 4 | Message cannot be routed. |
| 400 | 5 | Invalid delivery time. |
| — | 6 | Rejected or invalid content. |
| — | 7 | A parameter is not allowed; inspect the response details. |
| — | 8 | An invalid parameter was supplied; inspect the response details. |
| — | 12 | Fund the messaging account. |
| 401 | — | Authentication failed. |
| 402 | — | Insufficient messaging credit. |
| 403 | — | Recipient has not approved receipt of the message. |
| 404 | — | Message not found. |
| 500 | — | Server error. |
| 502 | — | No suitable gateway was found. |