All posts
Integrations· Axel Meta

Track Click-to-WhatsApp ads in n8n

Build one n8n job that saves the Click-to-WhatsApp referral on first contact, labels the lead, and sends the conversion back to Meta yourself.

You run a Click-to-WhatsApp ad on Facebook or Instagram. Someone taps it, lands in WhatsApp, and starts a chat. The message shows up in your inbox, but nothing on the screen tells you which ad sent them. By the time you scroll back, the link is gone.

Meta does attach that link. On the first inbound message from a Click-to-WhatsApp ad, the payload carries a referral object with the ad details and a click ID. WhatsAble passes that object straight through to n8n. But WhatsAble does not store it for you, and most chats drop the referral on the second message. If your n8n workflow does not read it on that first event, there is no second chance.

This guide builds the n8n job end to end. You catch and save the referral on first contact, mark the chat when the lead qualifies, and send the conversion back to Meta yourself. For the full breakdown of every referral field, read the Click-to-WhatsApp ad attribution guide on the blog. Here we stay on the n8n build.

What you are building

Three moves, all in n8n:

  1. Save the click ID and ad ID the moment the first message arrives, keyed to the contact's phone number.
  2. Mark the chat with a label you create when the lead is worth following up, then update your record.
  3. Send a conversion event to Meta's Conversions API with the saved click ID once the lead reaches a stage you care about.

WhatsAble does not create the ad and does not run any of these steps for you. You build them once in n8n and they run on every ad-sourced chat after that.

Before you start

You need a WhatsAble account with your WhatsApp number connected, access to n8n, and a Click-to-WhatsApp ad already running in Meta. Coexistence is supported, so the number keeps working in the WhatsApp Business app while n8n listens in the background. The node and credential steps live in the WhatsAble n8n docs.

Step 1: Catch and save the referral on first contact

Add the WhatsAble trigger node to a new workflow. In the node library, search for WhatsAble and pick the node with the official logo, then choose the trigger labelled "On new Incoming message event".

Two setup details trip people up here.

First, open the Webhook URLs section on the trigger, select the Production URL, and paste it into the WhatsAble credential when you create it. A credential that has the API key but no Production URL is the most common reason a workflow never fires.

Second, if you use the WhatsAble credential that covers incoming and outgoing messages, that same trigger also fires on outgoing messages, including replies you type in the WhatsApp Business app on your phone. Ad attribution only lives on inbound, so you have to filter.

Right after the trigger, add a Filter or IF node with two conditions:

  • incoming_message is true
  • referral exists

Both matter. The incoming_message check drops the outgoing events you do not want. The referral check drops ordinary chats that never came from an ad. Read referral from the top level of the payload. Only reach into messages[].referral if that nested envelope is what n8n actually received.

When both conditions pass, map the few fields you plan to keep. For attribution the short list is:

  • ctwa_clid, the click ID you send to Meta later
  • source_id, the Meta ad or post ID
  • the contact's phone_number

Grab headline and source_url too if you want the ad text sitting next to the row. The full field reference is in the hub attribution guide, so there is no need to copy all of it into your workflow.

Two shape issues to handle before you write anything:

  • phone_number can arrive as a number or a string. Coerce it to a string so your row keys stay consistent.
  • last_messages sometimes arrives as a JSON string instead of a parsed object. If you read from it, parse it first.

Now write the row. A Google Sheets "Append or update row" node, keyed on the phone number, is the simplest worked example: one column each for phone, ctwa_clid, source_id, and a timestamp. If your contacts live in a CRM, swap in an HTTP Request node or the CRM's own node and store the same values against the contact. Either way, write on this first event. Do not wait for a reply or a second message, because the referral is usually gone by then.

Step 2: Mark the chat when it qualifies

Saving the click ID tells you where the lead came from. A label tells you the lead is worth acting on, and it gives you a clean signal to update your record later.

Do not rely on a built-in label named qualified. Create your own custom label in WhatsAble, for example ctwa-lead, and use that. A team member can apply it from the inbox. On Pro and Agency, an AI chatbot can apply labels when you tell it to in Custom Instructions, and ProactiveBot can manage them as well.

Once the label is on the chat, later message events can include a labels field. The safe pattern in n8n is this: on a later inbound message event, filter when labels contains your custom label, then update the Sheet row or CRM record you keyed on the phone number in Step 1.

One thing to avoid. Do not build the workflow on the idea that applying a label by itself, with no new message, triggers the webhook. That path is unverified. Anchor the update to a real message event that carries the label.

Step 3: Send the conversion back to Meta

Capturing the referral shows you which ad started the chat. Sending a conversion event back to Meta shows Ads Manager whether that ad produced a result. These are two separate jobs, and this one is yours to build. WhatsAble does not ship a native Conversions API, and there is no "send qualified" button in the console.

When a contact reaches a stage you define, such as a booked call, a paid order, or a deal moved in your CRM, read the ctwa_clid you saved in Step 1 and post a server-side event to the Meta Conversions API from n8n.

A three-node shape covers it:

  1. A trigger for the qualifying stage: a new Sheet row, a form submission, or a CRM stage change.
  2. A node that looks up the saved ctwa_clid for that phone number.
  3. An HTTP Request node that posts the event to the Conversions API.

For a WhatsApp business messaging conversion, the event carries these values:

action_source: business_messaging
messaging_channel: whatsapp
ctwa_clid: <the value you saved on first contact>

You also need a Meta dataset ID and a system user access token from Business Manager. The call goes from n8n straight to Meta's API. WhatsAble is not in that request.

What you end up with

After these three moves are live:

  • Every ad-sourced contact lands in your Sheet or CRM with its click ID and ad ID, written at the moment of first message.
  • A label you created marks the chats worth chasing, and later messages that carry that label keep your record current.
  • Ads Manager gets server-side conversions that connect the original ad click to a real outcome, not just a chat that opened and went quiet.

None of this needs custom code. One n8n workflow can run the first two steps, and a second short workflow handles the conversion send. For the field reference, the destination options, and the same flow on a webhook, Zapier, or Make, read the Click-to-WhatsApp ad attribution guide. To wire up the trigger itself, the WhatsAble n8n integration page walks through the node and credential setup.

Ready to automate your WhatsApp?

Connect WhatsApp to Zapier, Make, n8n, Pipedrive, or Monday.com in minutes. Start free, no credit card required.

Start Free Trial