Skip to main content

Configure Webhooks

Now we'll tell Facebook where to send the lead data. This is called a "webhook" - it's like giving Facebook your CRM's mailing address.

What Is a Webhook?โ€‹

In simple terms:

Someone fills out your Lead Form on Facebook/Instagram
โ†“
Facebook says: "Hey, I got a new lead!"
โ†“
Facebook sends the lead data to YOUR webhook URL
โ†“
Your module receives it and creates the lead in Perfex CRM

A webhook is just a URL on your server that Facebook sends data to. The module creates this URL automatically - you just need to tell Facebook about it.

Get Your Webhook Details from Perfexโ€‹

Before going to Facebook, let's grab the details from your module:

  1. Log into Perfex CRM
  2. Go to Meta Leads โ†’ Settings in the sidebar
  3. First, enter your App ID and App Secret (from Step 1) and click Save Settings
  4. Scroll down to the Webhook Settings section
  5. You'll see two values:
FieldExampleWhat It Is
Webhook Callback URLhttps://yourcrm.com/facebookleadsintegration/webhookWhere Facebook sends data
Verify Tokena1b2c3d4e5f6g7h8i9j0A secret code to verify the connection
  1. Click the Copy button next to each value
warning

The Callback URL MUST start with https:// - Facebook requires SSL! If your URL starts with http://, you need to install an SSL certificate first.

Add Webhooks to Your Meta Appโ€‹

1. Open Your Meta App Dashboardโ€‹

Go to your app at:

๐Ÿ‘‰ https://developers.facebook.com/apps/

Click on your app to open it.

2. Add the Webhooks Productโ€‹

  1. In the left sidebar, look for "Add Product" or scroll down on the dashboard
  2. Find "Webhooks" in the product list
  3. Click "Set Up" or "Configure"
tip

If you already see "Webhooks" in the left sidebar, click on it directly - no need to add it again.

3. Select "Page" as the Object Typeโ€‹

  1. On the Webhooks page, you'll see a dropdown that says "User" by default
  2. Change this dropdown to "Page"
warning

This is critical! You MUST select "Page" - not "User", not "Application", not anything else. Lead data comes through Page subscriptions.

4. Subscribe to the Webhookโ€‹

  1. Click the "Subscribe to this object" button (or "Edit Subscription" if already configured)
  2. A dialog box will appear asking for two values:
FieldWhat to Enter
Callback URLPaste your Webhook URL from the module (e.g., https://yourcrm.com/facebookleadsintegration/webhook)
Verify TokenPaste your Verify Token from the module
  1. Click "Verify and Save"

5. What Happens When You Click "Verify and Save"โ€‹

Facebook will immediately send a verification request to your webhook URL:

Facebook: "Hey, is this really your server?"
Your Module: "Yes! Here's the verify token to prove it!"
Facebook: "Great, verified!"

If it works: You'll see a success message and the dialog closes.

If it fails: See the Troubleshooting section for common fixes.

6. Subscribe to "leadgen" Eventsโ€‹

After verification, you need to tell Facebook what events to send:

  1. You'll see a list of event types under "Page" subscriptions
  2. Find "leadgen" in the list (you might need to scroll)
  3. Click the "Subscribe" toggle/checkbox next to "leadgen"
tip

"leadgen" is the ONLY event you need. You don't need to subscribe to any other events (like "messages" or "feed"). Just "leadgen".

Verification Successful!โ€‹

Your webhook configuration should now look like this:

Webhooks
โ”œโ”€โ”€ Object: Page
โ”œโ”€โ”€ Callback URL: https://yourcrm.com/facebookleadsintegration/webhook โœ…
โ”œโ”€โ”€ Verify Token: โœ… Verified
โ””โ”€โ”€ Subscriptions:
โ””โ”€โ”€ โœ… leadgen (subscribed)

Back in your Perfex CRM module, the webhook status indicator should now show green/Verified!

How to Test the Webhookโ€‹

Want to make sure the webhook is working?

  1. Go to your Perfex CRM โ†’ Meta Leads โ†’ Settings
  2. Click the "Test Connection" button
  3. You should see all green checkmarks

We'll do more thorough testing later in the Testing Leads section.

Common Mistakes to Avoidโ€‹

MistakeFix
Selected "User" instead of "Page"Change the dropdown to "Page"
Forgot to subscribe to "leadgen"Find "leadgen" in the list and subscribe
Using HTTP instead of HTTPSInstall SSL certificate on your server
Typo in the Callback URLCopy-paste directly from the module settings
"Callback URL couldn't be validated"Check Troubleshooting

Webhook configured? Connect Your Pages