# Track WhatsApp Leads from Meta Ads

<figure><img src="https://2417185145-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhsdgGmVCG31mEaHyRvxC%2Fuploads%2FINFaK8sThvlUMS1g7aZt%2Fimage.png?alt=media&#x26;token=17a24e19-097a-45b9-9b51-904a93927c54" 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"
}
```
