# Track WhatsApp Leads from Meta Ads

<figure><img src="/files/MAS39LLXgf3z7TV1DdZQ" alt=""><figcaption></figcaption></figure>

When a user clicks on a Click-to-WhatsApp ad in Facebook or Instagram and sends you a message, our API delivers a webhook containing all relevant information.&#x20;

The incoming message webhook will include a `context.ad` object with details about the campaign:

* ad title and body
* media type and URLs
* AD ID and source link
* conversion token (if enabled)

This allows you to:

* Track the ad campaign each contact came from
* Attribute leads correctly
* Personalize replies based on the ad content
* Assign and route new leads in your CRM

You can find the `context.ad` and `context.conversion` fields inside the webhook payload when the contact reaches you through a Meta ad.

{% hint style="info" %}
Note: This attribution data is only available when the ad click results in a message and attribution is enabled in your WhatsApp Business settings.
{% endhint %}

***

Example webhook snippet:

```json
{
  "messages": [
    {
      "id": "TEST_MSG_ID_12345",
      "from_me": false,
      "type": "text",
      "chat_id": "60000000000@s.whatsapp.net",
      "timestamp": 1754275820,
      "source": "mobile",
      "text": {
        "body": "Hi, I'm interested in the double-storey terrace house. Can you share more info?"
      },
      "context": {
        "conversion": {
          "data": "TEST_CONVERSION_TOKEN_ABC123XYZ456",
          "source": "FB_Ads"
        },
        "ad": {
          "title": "Test Ad Campaign - Property Promo",
          "body": "🏠 Brand New Homes\n📍 Prime Location\n✅ Freehold Title\nContact us now",
          "media_type": "image",
          "preview_url": "https://example.com/media/preview.jpg",
          "media_url": "https://facebook.com/ads/testvideo123",
          "source": {
            "id": "TEST_AD_ID_987654321",
            "type": "ad",
            "url": "https://fb.me/testadlink123"
          },
          "attrib": true,
          "ctwa": "TEST_CTWA_TOKEN_1234567890"
        }
      },
      "from": "60000000000",
      "from_name": "Test User"
    }
  ],
  "event": {
    "type": "messages",
    "event": "post"
  },
  "channel_id": "MANTIS-M72HC"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.whapi.cloud/help-desk/faq/track-whatsapp-leads-from-meta-ads.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
