← All posts

Connecting WAGate to WooCommerce, WHMCS, XenForo and n8n

2 October 2026 · WAGate team

The API is deliberately boring: one endpoint, JSON in, JSON out. That's what makes it easy to bolt onto software you already run. Here are the recipes we get asked about most.

WooCommerce (WordPress)

Hook woocommerce_order_status_changed in a small plugin or your theme's functions.php:

add_action('woocommerce_order_status_changed', function ($order_id, $from, $to) {
    if ($to !== 'completed') return;
    $order = wc_get_order($order_id);
    $phone = preg_replace('/\D/', '', $order->get_billing_phone());
    wp_remote_post('https://signup.wagate.net/v1/messages', [
        'headers' => ['X-API-Key' => WAGATE_KEY, 'Content-Type' => 'application/json'],
        'body'    => wp_json_encode([
            'to'   => $phone,
            'text' => "Hi {$order->get_billing_first_name()}, order #{$order_id} is complete. Thanks for shopping with us!",
            'reference' => "wc-{$order_id}-{$to}",
        ]),
    ]);
}, 10, 3);

Normalise the phone to digits with country code — WooCommerce stores whatever the customer typed. The same hook with $to === 'processing' gives you “order received”.

WHMCS

WHMCS hooks live in includes/hooks/. For an invoice reminder:

add_hook('InvoiceCreated', 1, function ($vars) {
    $invoice = localAPI('GetInvoice', ['invoiceid' => $vars['invoiceid']]);
    $client  = localAPI('GetClientsDetails', ['clientid' => $invoice['userid']]);
    $phone   = preg_replace('/\D/', '', $client['phonenumberformatted']);
    // POST to /v1/messages as above with "Invoice #{$invoice['invoiceid']} for {$invoice['total']} is due {$invoice['duedate']}"
});

Useful WHMCS events: InvoiceCreated, InvoicePaid, TicketAdminReply, AfterModuleCreate (service ready). Add a client custom field for “WhatsApp opt-in” and check it before sending.

XenForo

For a forum, the natural triggers are conversation replies, approval notices and purchases. A small add-on that extends the relevant service classes and calls the API with the member's phone from a custom user field does the job; the member's opt-in lives in the same field. Because WAGate returns immediately with a queue ID, you can call it inline without slowing the request.

n8n / Make / Zapier

No code at all: use an HTTP Request node with method POST, URL https://signup.wagate.net/v1/messages, header X-API-Key, and a JSON body built from the previous node's fields. For inbound, point your WAGate webhook at an n8n Webhook trigger and branch on {{$json.event}} — a complete two-way WhatsApp bot in a few nodes.

Anything else

If it can make an HTTPS request it works: Laravel's Http::post(), Python's requests.post(), a bash curl in a cron job, Home Assistant's rest_command. For the GET-only tools out there, /v1/send?api_key=…&to=…&text=… exists precisely so you aren't stuck.

Need a plugin we haven't written yet? Tell us — popular ones go on the roadmap.

Try WAGate free for 5 days

Link your WhatsApp number, get an API key and send your first message in minutes. No card required — pay with crypto when you're ready.

Start free trial See plans

More from the blog