Back to Blog
Integration Guides

How to Integrate Twilio with WhatsApp Business: Step-by-Step Guide

Connect Twilio to the WhatsApp Business API to send template messages, handle inbound conversations, and build automated WhatsApp flows.

DA
Danial A
Senior Twilio Consultant, Telphi Consulting
June 22, 2026
7 min read
Twilio
Integration
Messaging
AI Bots
How to Integrate Twilio with WhatsApp Business: Step-by-Step Guide

Twilio and WhatsApp Business integrate through Twilio's WhatsApp Business API sender, enabling you to send approved template messages for transactional notifications and engage in two-way conversations once a customer initiates contact or responds to a template, all using the same Twilio Messages API you already use for SMS. This integration is used by e-commerce brands, logistics companies, healthcare providers, and financial services teams who need to reach customers on WhatsApp at scale with delivery receipts, read receipts, and rich media support that SMS cannot provide. The connection is made through a Twilio WhatsApp-enabled sender registered under your Meta Business Manager account, with Twilio acting as the Business Service Provider handling API access, delivery, and compliance.

What You Need Before You Start

Apply for a Twilio WhatsApp Business sender by navigating to the Twilio Console under Messaging, then Senders, then WhatsApp Senders, and clicking Submit Request, which initiates the Meta Business Verification process requiring your Meta Business Manager account ID and business documentation. Complete Meta Business Verification in your Meta Business Manager at business.facebook.com by providing your legal business name, website, and business phone number, then waiting for Meta to approve the verification before your Twilio WhatsApp sender becomes active. Create WhatsApp message templates in the Twilio Console under Messaging, then Content Template Builder, submitting each template for Meta review with the template category set to UTILITY for transactional messages or AUTHENTICATION for OTP flows, noting that MARKETING templates require explicit opt-in records. From Twilio, collect your Account SID, Auth Token, and the WhatsApp-enabled sender number in the format whatsapp:+14155551234, and confirm that customers have opted in to receive WhatsApp messages from your business before sending any outbound template messages to remain compliant with Meta's policies.

Step-by-Step Integration Guide

Send a WhatsApp template message by calling POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json with Basic authentication, To set to whatsapp:{customerPhone} in E.164 format prefixed with whatsapp:, From set to whatsapp:{yourTwilioWhatsAppNumber}, and ContentSid set to the approved Twilio Content Template SID from your template library, plus ContentVariables set to a JSON object mapping your template variable positions to their values such as {"1":"John","2":"Order #12345"}. Configure the inbound WhatsApp webhook by setting your WhatsApp sender's incoming message webhook URL in the Twilio Console to your middleware endpoint, which Twilio calls with a POST payload containing From (the customer's WhatsApp number), Body (their message text), and NumMedia (count of media attachments) when a customer sends an inbound WhatsApp message to your sender. Reply within the 24-hour customer service window by sending a free-form message without a ContentSid, setting only the Body parameter, which is allowed when the customer has messaged your business within the past 24 hours and opens a session in which you can send any message content without pre-approval. Handle delivery and read receipts by configuring a StatusCallback URL on each outbound message API call set to your middleware endpoint, which Twilio calls with MessageStatus values of sent, delivered, read, and failed so your system can track which customers have read each message.

Common Issues and How to Fix Them

Outbound template messages fail with a Twilio 63016 error when the template has not been approved by Meta or when the ContentSid references a template that is in a rejected state, which can happen silently when Meta rejects a template category mismatch such as sending a UTILITY template with marketing content. Check template approval status by calling GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Content/ContentTemplates/{ContentSid}.json and checking the approval_requests array for each template's status field, and resubmit rejected templates with corrected content and the appropriate category. The 24-hour session window expires if a customer does not respond to a template message within 24 hours, and any subsequent free-form message attempt fails with a 63032 error. Detect session expiry in your middleware by storing the last inbound message timestamp per customer WhatsApp number and checking whether the current time minus that timestamp exceeds 86,400 seconds before attempting a free-form reply, and if the session is expired send a new template message instead to re-open the window. WhatsApp phone numbers in your customer database are often stored without the country code or with local formatting, and the Twilio WhatsApp API requires the To parameter in the format whatsapp:+{countryCode}{nationalNumber} with no spaces or dashes. Normalize customer phones to E.164 before prepending the whatsapp: prefix, using the Twilio Lookup API at GET https://lookups.twilio.com/v2/PhoneNumbers/{number} to validate and format each number, and log validation failures to a separate queue for manual review.

How to Get More from This Integration

Build an interactive WhatsApp customer service flow using Twilio's Content API interactive templates by creating a template with the type set to twilio/list-picker or twilio/call-to-action, which renders native WhatsApp quick reply buttons and call-to-action buttons in the customer's chat, enabling menu-driven customer service without requiring the customer to type free-form text. Add rich media to WhatsApp notifications by including the MediaUrl parameter on outbound template messages pointing to a publicly accessible JPEG, PNG, or PDF file, enabling order invoice delivery, shipping label sharing, and product image notifications that display inline in the customer's WhatsApp chat. Create an opt-in collection flow by setting up a Twilio WhatsApp sandbox keyword or a short URL that opens a WhatsApp conversation with your business, capturing the customer's WhatsApp number as the From value in your inbound webhook handler and storing it in your CRM as a consented WhatsApp contact with the opt-in timestamp for compliance records. Implement a WhatsApp notification preference center by sending a Twilio list picker template asking customers to select their preferred contact channel, storing the response in your database, and routing future notifications to WhatsApp or SMS based on the customer's stated preference, improving engagement by using each customer's preferred channel.

Conclusion

Twilio and WhatsApp Business together give your business a compliant, scalable channel for transactional notifications and two-way customer conversations on the world's most widely used messaging app. Contact Telphi Consulting to set up your Twilio WhatsApp Business sender and build automated messaging flows for your customer communication.

Share this article:
0 views

Ready to Transform Your Business Communications?

Get a free consultation with our VoIP experts and discover how we can help you save costs, improve efficiency, and scale your business.

Comments (0)

Join the discussion and share your thoughts (AI-moderated for quality)

Protected by AI moderation

Be the first to comment

No comments yet. Share your thoughts below.