Order confirmations, delivery updates, fee reminders and sign in codes reach many Ghanaian customers by SMS or WhatsApp rather than email. Building these features well means integrating with a messaging provider's API, keeping your app fast when messages are slow, and respecting people's right to stop receiving them. Adverts we read mentioned integrations, event based communication and asynchronous processing, which is exactly what this work involves.
Sending a message through a provider
You do not connect to the mobile network yourself. You sign up with an SMS or messaging provider, get API keys and a sender name, and call their API:
await fetch(SMS_API_URL, {
method: "POST",
headers: { Authorization: `Bearer ${KEY}` },
body: JSON.stringify({
to: "0241234567",
text: "Order 981 is ready. Thank you!",
}),
});Each provider's URL, fields and phone format differ, so read their documentation and use their test mode first. Many also send delivery reports to a webhook, using the same ideas as payment webhooks.
Do not make users wait for messages
An SMS call might take a few seconds or fail. If your order endpoint waits for it, a slow provider makes your whole app slow. Instead, save the order, reply to the user straight away, and send the message in the background: