Lessons
Practical patterns to apply on day one.
1. Send safely: idempotency keys
await client.sms.send(
{ to: '0712345678', message: 'Order #42 confirmed' },
{ idempotencyKey: `order:${orderId}` }
)If a retry fires, the API replays the stored result instead of sending twice.
2. Double-check emoji pricing
const a = getSmsPartInfo('Thanks 🙏')
const b = getSmsPartInfo('Thanks a lot!')
console.log(a.encoding, a.creditsRequired) // UCS-2 → more credits
console.log(b.encoding, b.creditsRequired) // GSM-7 → 1Analyze before you send — see SMS Calculator.
3. Prefer bulk for blast-style messaging
Same message, many recipients → client.sms.bulk(). Different messages → client.sms.sendMany(messages, { rateLimitPerSec: 10 }).
4. React to delivery, not to send
Update order state on the sms.delivered webhook, not on the send response. Keep a small dedup set keyed by message_id + event. See Webhooks.
5. Keep the client server-side
In Next.js, instantiate SendAfricaClient in an API route or server action, never in a component bundle. Use logsJwt(jwtToken, ...) only when acting on a dashboard session.
Last updated on