ChannelsIntermediate

Connecting WhatsApp Business API via Twilio

Full setup guide for connecting WhatsApp Business messaging to DMHub using your Twilio account.

6 min readUpdated April 20, 2025

Prerequisites

  • A Twilio account with WhatsApp enabled (twilio.com/console)
  • A WhatsApp Business Account approved by Meta
  • A phone number enabled for WhatsApp in Twilio

Step 1: Get your Twilio credentials

  1. Log in to console.twilio.com
  2. From the dashboard, copy your Account SID and Auth Token
  3. Go to Messaging → Senders → WhatsApp Senders
  4. Copy the sender number (format: whatsapp:+1XXXXXXXXXX)

Step 2: Configure the webhook

DMHub automatically sets the webhook for you when you connect, but verify it's correct:

  1. In Twilio console, go to Messaging → Services or directly to your WhatsApp sender
  2. The webhook URL should be set to:

``` https://www.dmhub.ai/api/webhooks/twilio/whatsapp ```

  1. Set the method to HTTP POST

Step 3: Connect in DMHub

  1. Go to /settings/channels
  2. Click Add Channel → WhatsApp → Twilio
  3. Enter:

- Account SID - Auth Token - WhatsApp sender number

  1. Click Connect

DMHub sends a test message to verify the connection. You'll see a confirmation in the UI.

Step 4: Configure message templates

WhatsApp requires pre-approved templates for outbound messages sent outside the 24-hour conversation window.

Go to /settings/channels → your WhatsApp channel → Templates. DMHub includes 80+ pre-built templates for common scenarios:

  • Appointment reminders
  • Order confirmations
  • Payment receipts
  • Follow-up messages

To submit a new template, click New Template and fill in the content. Meta typically approves templates within 24 hours.

Understanding the 24-hour window

WhatsApp allows free-form messages only within 24 hours of the customer's last message. After that window closes:

  • You must use a pre-approved template
  • Templates can include dynamic variables like {{customer_name}} and {{order_number}}

DMHub tracks window status on each conversation and warns you when it's about to close.

Troubleshooting

SymptomLikely causeFix
Messages not arrivingWrong webhook URLVerify webhook in Twilio console
"Not a WhatsApp number" errorMissing whatsapp: prefixUse whatsapp:+1... format
Template rejectedPolicy violationReview Meta's content guidelines

See WhatsApp template not approved for more on template issues.

whatsapptwiliochannels

Was this article helpful?

Let us know if this answered your question or if you need more help.

Send feedback
Connecting WhatsApp Business API via Twilio | DMHub Help