Setting Up A Meta CAPI Callback via Webhook
This article outlines how you can set up a basic Meta CAPI callback webhook on LeadByte to sync conversion data back to Facebook. Meta CAPI requires a Unix timestamp and user data fields such as email / phone to be encrypted with SHA256 when sent over, so this article shows how that can be done.
To set up a webhook, go to "Tech Hub" -> "Outbound Webhooks" and "+ Add new Webhook".
Give your webhook a reference name.
Choose the type of webhook you want to create - for my example I chose Lead Sold/Unsold.
Choose the capture method.
Choose webhook version 1.6 for a custom payload.
Choose custom for payload type.
The URL should be set as: https://graph.facebook.com/{API_VERSION}/{PIXEL_ID}/events (replacing the values).
Choose which campaign or tick to enable for all current and future campaigns.
Choose which deliveries or tick to enable for all deliveries and all future deliveries under those campaigns.
Choose the sold status to trigger on - I have just selected "Sold" for my example.
Choose POST as your request method.
Choose JSON as your payload type.
Here is an example payload.
{
"data": [
{
"event_name": "Lead",
"event_time": [received],
"action_source": "website",
"user_data": {
"em": ["[email]"],
"ph": ["[phone1]"]
}
}
]
}
When I paste that payload into the payload builder, the [email] / [phone1] / [received] fields are added below with formatting actions.
Above these set the "Encryption Type" dropdown to SHA256 and then tick Email address & Phone number
This will SHA256 encrypt the [email] & [phone1] tags.
The next step is to click the "Options" for the [received] field as this needs to be output in Unix.
Just click options and then tick "Unix"
You will also need to do the same for the [phone1] tag, but ticking the international format option without a +
When the webhook fires, the output will look like this:
{
"data": [
{
"event_name": "Lead",
"event_time": 1789643058,
"action_source": "website",
"user_data": {
"em": ["9bca128267552a8906d7dd19653a667f366c94a4af441251f4911148c398efa1"],
"ph": ["0a70dc9bf88c38742601687420797615c366d7a73d376b970ae91f7594b99e6a"]
}
}
]
}
If you have any questions at all please feel free to raise a ticket with support.
Comments