Skip to main content

Tutorial

Send WhatsApp from a WordPress form

WhatsApp notifications on form submission are coming in Core Forms 4.1. Here's how to do it today via webhook + Meta Cloud API, and the gotchas.

WhatsApp is the inbox most Indian, LATAM, and SEA businesses actually live in. Send an email, it’ll get read tomorrow. Send a WhatsApp, the user replies in 90 seconds.

Native WhatsApp actions are on the Core Forms roadmap for 4.1. Until that ships, here’s how I do it today, and what the gotchas are.

The three approaches

1. Meta WhatsApp Cloud API (free tier, official). First 1,000 conversations a month are free. Template messages can hit any opt-in number. In-window text messages are unlimited inside a 24-hour customer service window. This is what 4.1 will wrap natively.

2. Twilio WhatsApp. Easier setup. Sandbox for instant testing. Pay-as-you-go (~$0.005 per message in most regions). Worth it if your team’s already on Twilio.

3. Click-to-WhatsApp link. Generate a wa.me URL with the form data pre-filled. The user clicks it on their phone and lands in WhatsApp ready to send to you. Zero API cost, but the user has to take the action.

For most lead-gen flows, option 1 or option 3 is what you want.

Option 1: Meta WhatsApp Cloud API today

Until the native action ships, use the webhook action plus a small WordPress mu-plugin. Here’s the entire setup.

Step 1: Get the credentials.

  • developers.facebook.com → Apps → Create App → Business → Add WhatsApp.
  • Copy the temporary access token and the phone number ID from the WhatsApp setup page.
  • Add a test recipient number in the same screen (you can only message verified numbers until the app is approved).

Step 2: Create the message template.

In the WhatsApp Manager, create a template named lead_alert with a body like:

New lead from {{1}} ({{2}}). Inquiry: {{3}}.

Submit for approval. Meta usually approves business-utility templates in under an hour.

Step 3: Drop a tiny mu-plugin.

Create /wp-content/mu-plugins/cf-whatsapp.php:

<?php
add_action( 'cf_form_success', function( $submission, $form ) {
    if ( $form->slug !== 'demo-request' ) return;

    $phone_id = 'YOUR_PHONE_NUMBER_ID';
    $token    = 'YOUR_ACCESS_TOKEN';
    $to       = '15551234567'; // your team's WhatsApp

    $payload = [
        'messaging_product' => 'whatsapp',
        'to'                => $to,
        'type'              => 'template',
        'template'          => [
            'name'     => 'lead_alert',
            'language' => [ 'code' => 'en_US' ],
            'components' => [[
                'type' => 'body',
                'parameters' => [
                    [ 'type' => 'text', 'text' => $submission->data['name']    ?? '' ],
                    [ 'type' => 'text', 'text' => $submission->data['email']   ?? '' ],
                    [ 'type' => 'text', 'text' => $submission->data['inquiry'] ?? '' ],
                ],
            ]],
        ],
    ];

    wp_remote_post( "https://graph.facebook.com/v20.0/{$phone_id}/messages", [
        'headers' => [
            'Authorization' => 'Bearer ' . $token,
            'Content-Type'  => 'application/json',
        ],
        'body'    => wp_json_encode( $payload ),
        'timeout' => 10,
    ] );
}, 10, 2 );

That’s the whole bridge. The cf_form_success hook fires after every successful submission. Filter on the form slug, build the WhatsApp template payload, fire it.

When Core Forms 4.1 ships the native action, you’ll delete this file and configure the action through the UI.

Option 2: Click-to-WhatsApp (zero API)

For lead-handoff flows (the user contacts you on WhatsApp), you don’t need an API at all. Use the form submission to generate a wa.me link and redirect to it.

In the form’s Settings tab, set the Redirect URL on success to:

https://wa.me/15551234567?text=Hi,%20I%27m%20interested%20in%20your%20services.%20Name:%20[name]%20Email:%20[email]

Core Forms substitutes [name] and [email] with submitted values. The user lands in WhatsApp on their phone, the message is pre-typed, they hit send.

This is the right pattern for “high-intent visitor wants to talk to a human” forms. No template approval, no API token, just a redirect.

Option 3: Twilio WhatsApp

Twilio’s WhatsApp sandbox is the fastest way to test. Once your sandbox is connected:

  • In Core Forms, Add actionWebhook.
  • POST URL: https://api.twilio.com/2010-04-01/Accounts/{ACCOUNT_SID}/Messages.json
  • Auth: Basic auth with {ACCOUNT_SID} : {AUTH_TOKEN}.
  • Body params: From, To, Body (your message).
  • Pre-pend both From and To with whatsapp:.

For production WhatsApp on Twilio, you go through their template approval process, similar to Meta’s. The advantage of Twilio: a single account handles WhatsApp + SMS + voice, useful if you already use them for SMS.

Native Twilio SMS support ships in Core Forms today. Twilio WhatsApp is on the roadmap alongside Meta Cloud API.

What to watch out for

Template approval. Meta and Twilio both require templates for outbound messages to non-opted-in numbers. Approval takes 30 minutes to 24 hours. Plan for it.

24-hour customer service window. Once a user messages you, you have 24 hours to reply with free-form text. Outside the window, you need a template.

Cost at scale. WhatsApp Business pricing is per-conversation, not per-message. Free for the first 1,000/month from Meta. After that, ~$0.005 per conversation in India, ~$0.04 in the US. For most lead alerts, the cost is rounding error.

Phone number verification. You can’t WhatsApp arbitrary phone numbers from a business account. Either the recipient opted in (replied to a prior message), or the recipient is on your test list, or you’ve cleared template approval.

The next step

For lead-handoff (visitor wants to chat): use the click-to-WhatsApp redirect today. Five-minute setup.

For team alerts (your team gets a ping when a lead comes in): use the mu-plugin bridge above, and switch to the native action when 4.1 ships.

The roadmap entry tracks all three approaches. Email me if you want a heads-up the day 4.1 lands.

Build the form. Stop reading.

Every note here came out of a real Core Forms setup. Use CFLAUNCH for 20% off either plan.