How to Use WhatsApp Business API with Twilio
Wiki Article
WhatsApp is one of the world’s most-used messaging platforms — 2 billion+ users. The WhatsApp Business API via Twilio lets you build automated messaging, notifications and two-way customer conversations at scale.
WhatsApp has an open rate of over 98% — compared to around 20% for email. For web development agency for startups businesses that need to reach customers reliably, the WhatsApp Business API is one of the most powerful tools available. Twilio acts as a provider of the WhatsApp Business API, making it straightforward to integrate into any application using their familiar REST API pattern.
How Twilio WhatsApp Works
Twilio provides access to the WhatsApp Business API through their Messaging API — the same API you use for SMS. The key difference is the whatsapp: prefix on the phone number. To send a WhatsApp message via Twilio:
- Your Twilio account must have WhatsApp enabled (via the Twilio Console)
- For production, you need aWhatsApp Business Account (WABA)approved by Meta
- For testing, Twilio provides a sandbox number so you can build and test without approval
- All outbound messages outside a 24-hour window must use pre-approvedmessage templates
Message Templates
Meta requires that proactive (outbound) WhatsApp messages — sent outside the 24-hour customer service window — use approved templates. Templates are structured message formats submitted to Meta for review before use.
Common template categories include:
- Utility — Order confirmations, shipping updates, appointment reminders, booking confirmations
- Authentication — OTP and verification codes
- Marketing — Promotional offers, product announcements (requires opt-in)
Within the 24-hour window (after a customer messages you first), you can send free-form replies without a template. This is the session window and is where customer support conversations happen.
Two-Way Messaging
Twilio routes inbound WhatsApp messages to a webhook URL you configure. When a customer replies, Twilio sends a POST request to your server with the message body, sender number and media attachments (if any). Your application processes the message and can reply instantly — enabling chatbot flows, support ticket creation or live agent handover.
Use Cases
- Appointment reminders — Send a WhatsApp reminder 24 hours before an appointment with confirm/reschedule buttons
- Order updates — Dispatch notifications, delivery tracking and collection alerts
- OTP authentication — Two-factor authentication via WhatsApp (higher delivery rates than SMS in some countries)
- Customer support — Route WhatsApp conversations to your helpdesk or support agents
- Lead qualification — WhatsApp chatbot that qualifies inbound leads and books sales calls
- Post-purchase follow-up — Review requests, upsell offers and loyalty messaging
Getting Started: The Steps
- Create a Twilio account and enable the WhatsApp Sandbox for testing
- Connect your WhatsApp-enabled phone to the sandbox (scan a QR code)
- Build your integration using Twilio’s Messaging API withwhatsapp:+14155238886as the sender
- When ready for production, apply for a WhatsApp Business Account via Twilio’s self-serve flow
- Submit your message templates for Meta approval (24–48 hours typical)
- Switch from sandbox to your approved WABA number in production
Twilio WhatsApp Pricing
Twilio charges a per-message fee plus the Meta conversation fee (billed separately by Meta). Twilio’s per-message rate is approximately $0.005 per message. Meta charges per 24-hour conversation window — utility and authentication conversations are cheaper than marketing conversations. For high-volume messaging, costs reduce significantly with Twilio volume discounts.
When to Hire a Developer
The Twilio WhatsApp sandbox is easy to get started with, but building a production-ready integration requires proper architecture: webhook handling with retries, template management, opt-out tracking, conversation state management and integration with your CRM or backend. This is the work a specialist Twilio developer handles correctly from the start.