WhatsApp Business API Overview
Send rich media messages, interactive buttons, and automated chatbots on the official WhatsApp Business Platform. AfriRoute is an official WhatsApp Business Solution Provider with 99.9% uptime across Africa.
🚀 Quick Start
curl -X POST https://api.afriroute.ai/api/v1/whatsapp/messages \
-H "Authorization: Bearer $AFRIROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+251911234567",
"type": "template",
"template": {
"name": "welcome_message",
"language": "en"
}
}'
🔑 Authentication
All requests authenticate with your API key passed as a Bearer token:
Authorization: Bearer $AFRIROUTE_API_KEY
Generate and rotate keys from the dashboard. All endpoints are served over HTTPS from the base URL https://api.afriroute.ai. Phone numbers must be in E.164 format (e.g. +251911234567).
📤 Message Types
| Type | Use case | Section |
|---|---|---|
template | Outbound, first contact, reopen 24h window | Templates |
text | Free-form reply inside 24h window | Send Message |
image / video / document / audio | Rich media | Media |
interactive | Buttons, lists, CTA | Interactive |
⏱️ The 24-Hour Window
WhatsApp enforces a customer service window:
- The first message to a user who has never messaged you must be a pre-approved template.
- Once the user replies, you may send any message type for 24 hours.
- The window resets each time the user sends a new message.
- After the window closes, you must send a template to reopen the conversation.
📡 Core Endpoints
POST /v1/whatsapp/messages # Send any message type
GET /v1/whatsapp/messages/:id # Retrieve message status
POST /v1/whatsapp/templates # Create a template
GET /v1/whatsapp/templates # List templates
POST /v1/whatsapp/media # Upload media, returns media_id
GET /v1/whatsapp/media/:id # Download media
📊 Standard Response
Every successful send returns a message envelope:
{
"messaging_product": "whatsapp",
"message_id": "wamid.HBgM...",
"to": "+251911234567",
"status": "accepted",
"timestamp": "2026-05-28T10:30:00Z"
}
Status values: accepted, sent, delivered, read, failed
🌍 Coverage
WhatsApp reaches users in all 54+ African countries plus global delivery. Local display numbers are available for Ethiopia, Kenya, Nigeria, South Africa, Tanzania, Uganda, Ghana, and Rwanda. View full coverage →
💡 Best Practices
- Register and pre-approve templates before launch to avoid send failures.
- Collect explicit opt-in before initiating conversations.
- Verify webhook signatures with
x-hub-signature-256. - Respect the 24-hour window to control conversation costs.
- Provide opt-out instructions in business-initiated templates.
⚠️ Error Handling
{
"error": {
"code": 131051,
"title": "User not opted in",
"details": "Recipient has not granted consent to receive messages"
}
}
| Code | Description | Solution |
|---|---|---|
| 130472 | Not a WhatsApp user | Verify phone number |
| 131026 | Template not approved | Submit for review |
| 131051 | User not opted in | Get explicit consent |
| 133004 | Message undeliverable | Check number format |
💰 Pricing
| Conversation type | Price | Description |
|---|---|---|
| User-initiated | $0.02 | User messages you first |
| Business-initiated | $0.05 | You send a template |
| Service | $0.01 | Utility messages (OTP, etc.) |
📚 Related Resources
Need help? Contact Support → | Last Updated: May 2026