You want form submissions from your Contact Form 7 to arrive as WhatsApp messages. Not emails that sit unread. Not SMS that costs per message. WhatsApp messages that your team actually sees and responds to.
The "Contact Form to Any API" plugin can do this. But the setup has specific requirements that trip up most people: template approval, Base64 authentication, and Twilio's strict payload format. This guide walks through the exact configuration, the errors you will hit, and how to fix them.
The Architecture: Why This Is Not Just Another API Call
WhatsApp Business API is fundamentally different from email or SMS APIs. It enforces strict rules on who can message whom, and when.
The data flow looks simple:
CF7 Form → Contact Form to Any API → Twilio Messages API → WhatsApp Message Delivered
But the constraints are not simple. WhatsApp divides messages into two types: Session messages and Template messages. A session starts when a user messages your business first. Within that 24-hour window, you can send free-form replies. Outside that window, you can only send pre-approved templates. Since a CF7 form submission is business-initiated, you must use a template. There is no workaround.
This is the first thing most guides gloss over. If you skip template creation, your messages will fail silently or return error 63016.
Prerequisites: What You Need Before Touching the Plugin
Three things must be in place before you configure a single field in WordPress.
A Twilio account with WhatsApp enabled. You need your Account SID and Auth Token. For production, you also need a registered WhatsApp sender. The Twilio Sandbox is for testing only and expires after three days.
An approved WhatsApp message template. This is non-negotiable. You create it in Twilio's Content Template Builder, submit it for WhatsApp review, and wait for approval. Machine review typically takes minutes. Manual review can take up to 48 hours.
A clear understanding of ContentSid and ContentVariables. Twilio's modern WhatsApp API uses these parameters, not a raw Body parameter. Using Body outside a conversation window will fail with error 63016.
Step 1: Create a Template That Will Actually Get Approved
WhatsApp rejects templates for reasons that are not always obvious. Understanding the rejection criteria saves days of back-and-forth.
The most common rejection reasons according to Twilio's documentation:
| Rejection Reason | What It Means | Fix |
|---|---|---|
| Variable at the start or end |
{{1}}, thank you or Hello {{1}}
|
Add text before or after the variable |
| Adjacent variables | {{1}}{{2}} |
Insert a word between them or combine |
| Non-sequential variables | {{1}}, {{2}}, {{4}} |
Use sequential numbering |
| Too vague | Hi {{1}}, thanks |
Add context about why the message exists |
| Newlines or tabs | Extra whitespace | Remove them |
| Duplicate content | Same template, different name | Modify both name and content |
A template that will be approved looks like this:
Hello {{1}}, you have a new inquiry from {{2}}. Their message: {{3}}
This has context (new inquiry), sequential variables, and text before and after each placeholder. It will pass machine review quickly.
Copy the Template SID once approved. It starts with HX. You will need it for the plugin payload.
For a deeper dive into JSON structure mapping and variable handling, read this guide on Contact Form 7 JSON mapping.
Step 2: Authenticate with Base64 (The Step Everyone Gets Wrong)
Twilio uses HTTP Basic Authentication. The plugin's header field is a static textarea. PHP functions like base64_encode() do not execute here. You must encode the credentials manually.
Twilio's official recommendation is to use API Keys, not your Account SID and Auth Token, for production. However, the plugin's official Twilio guide uses Account SID and Auth Token for simplicity. For a production integration handling real customer data, create an API Key in Twilio Console and use that instead.
The encoding process:
- Combine your credentials:
ACCOUNT_SID:AUTH_TOKEN(orAPI_KEY_SID:API_KEY_SECRET) - Base64-encode the combined string
- In the plugin's Request Headers field, add:
Authorization: Basic YOUR_BASE64_ENCODED_STRING
Content-Type: application/json
If you get a 401 error, the encoding is wrong. Verify there are no spaces before or after the encoded string.
For a comprehensive breakdown of authentication options, see this guide on Contact Form 7 API authentication errors.
Step 3: Build the Payload That Twilio Actually Expects
The plugin's official Twilio WhatsApp documentation provides this structure:
{
"To": "whatsapp:[phone-number]",
"From": "whatsapp:YOUR_TWILIO_WHATSAPP_NUMBER",
"ContentSid": "HX_YOUR_TEMPLATE_SID",
"ContentVariables": {
"1": "[your-name]",
"2": "[your-email]",
"3": "[your-message]"
}
}
Critical details that cause failures:
-
Tomust includewhatsapp:before the phone number. Without it, Twilio returns error 63007 (channel not found). -
Frommust be your registered WhatsApp sender, not a regular SMS number. For Sandbox testing, usewhatsapp:+14155238886. -
ContentVariableskeys must match your template's variable count. If your template has three variables, your payload must have exactly three keys. A mismatch returns error 132000. - The number of variables in the template determines the number of ContentVariables entries. You cannot add extra variables that do not exist in the approved template.
Step 4: Test with the Sandbox Before Going Live
The Twilio Sandbox is the only way to test without a production WhatsApp sender. But it has limitations that confuse people.
Sandbox limitations:
- Recipients must join your sandbox by sending
join <code>to the sandbox number - Sessions expire after three days
- Only pre-approved templates work (you cannot use custom templates)
- One message every three seconds rate limit
- Not available in the new Twilio Console; use the legacy Console
To test:
- Activate the Sandbox in the legacy Twilio Console
- Have your phone join the sandbox
- Configure the plugin with
whatsapp:+14155238886as theFromvalue - Use one of the Sandbox's pre-approved templates
- Submit a test form and verify the message arrives
If the sandbox works but production fails, the issue is your production sender's status or template approval. Check that your sender's status is ONLINE in Twilio Console.
The Errors You Will Hit and Exactly How to Fix Them
Error 63007: Channel Not Found
What it means: The From address is not formatted correctly or is not associated with a WhatsApp sender.
Fix: Verify the From value uses the exact format whatsapp:+[number]. If using Sandbox, confirm the sandbox is activated in the same account. If using a live sender, check that the sender status is ONLINE.
Error 63016: Outside the 24-Hour Window
What it means: You are trying to send a free-form message outside the 24-hour customer service window, or you are using the Body parameter instead of ContentSid.
Fix: Use ContentSid and ContentVariables. Never use Body for business-initiated messages. This is the single most common production failure.
Error 63040: Template Rejected
What it means: The template was rejected by WhatsApp, or your payload matches a rejected template.
Fix: Check the rejection reason in Twilio Console. Common causes: vague content, non-sequential variables, placeholders at the start or end. Submit a new template with a different name. WhatsApp prevents reuse of a rejected name for 30 days.
Error 132000: Template Param Count Mismatch
What it means: The number of variables in ContentVariables does not match the template's variable count.
Fix: Count the {{1}}, {{2}}, etc. in your approved template. Your ContentVariables object must have exactly that many keys.
The Debugging Checklist
| Step | Action | What It Reveals |
|---|---|---|
| 1 | Check plugin API Logs | Was a request sent? What response code? |
| 2 | Check Twilio Console > Monitor > Logs | Detailed error code and message |
| 3 | Verify template status | Is it Approved? Pending? Rejected? |
| 4 | Check From format |
Does it start with whatsapp:? |
| 5 | Check ContentSid
|
Does it match your approved template? |
| 6 | Count ContentVariables | Does it match the template's variable count? |
| 7 | Verify Base64 encoding | Is the Authorization header correctly formatted? |
Beyond the Basics: What Nobody Tells You
WhatsApp charges per template message, not per session message. Two-way conversations (where the user replies) are cheaper. Design your template to encourage a reply. A template like "Reply YES to confirm" opens a session and reduces costs.
Template approval is not permanent. Templates can be paused or disabled if users repeatedly block or report your messages. Monitor template quality in Twilio Console. If a template is paused, messages using it will fail.
The Sandbox is not a production environment. It expires. It has rate limits. It displays the Twilio logo. Use it to validate your payload and authentication. Then move to a production sender before going live.
Beyond WhatsApp: One Form, Multiple Destinations
Once your WhatsApp integration works, you might want to send the same form submission to other tools: a CRM, an email marketing platform, or a help desk system.
A good connector plugin supports multiple API integrations from a single form submission. You can send a WhatsApp message via Twilio, create a CRM contact, and subscribe the user to Mailchimp, all from one CF7 submission. For a cost comparison, see this article on Zapier vs a dedicated API plugin.
Key Takeaways
WhatsApp Business API requires pre-approved templates. There is no free-form workaround for business-initiated messages. Create and approve a template before configuring the plugin.
ContentSid and ContentVariables are mandatory. The Body parameter will fail with error 63016 outside a conversation window.
Base64 encoding must be done manually. The plugin's header field does not execute PHP. Encode ACCOUNT_SID:AUTH_TOKEN externally.
The From value must use the whatsapp: prefix. Error 63007 is the result of forgetting this.
Test with Sandbox, but do not ship with it. Sandbox sessions expire and templates are limited. Move to a production sender before going live.
With an approved template, correctly encoded credentials, and a payload that matches Twilio's modern Content API, your CF7 form submissions will arrive as WhatsApp messages on your team's phones. No missed inquiries. No email delays.
Top comments (0)