Skip to main content

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​

TypeUse caseSection
templateOutbound, first contact, reopen 24h windowTemplates
textFree-form reply inside 24h windowSend Message
image / video / document / audioRich mediaMedia
interactiveButtons, lists, CTAInteractive

⏱️ 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"
}
}
CodeDescriptionSolution
130472Not a WhatsApp userVerify phone number
131026Template not approvedSubmit for review
131051User not opted inGet explicit consent
133004Message undeliverableCheck number format

💰 Pricing​

Conversation typePriceDescription
User-initiated$0.02User messages you first
Business-initiated$0.05You send a template
Service$0.01Utility messages (OTP, etc.)

View detailed pricing →


Need help? Contact Support → | Last Updated: May 2026