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:
- Log into Perfex CRM
- Go to Meta Leads โ Settings in the sidebar
- First, enter your App ID and App Secret (from Step 1) and click Save Settings
- Scroll down to the Webhook Settings section
- You'll see two values:
| Field | Example | What It Is |
|---|---|---|
| Webhook Callback URL | https://yourcrm.com/facebookleadsintegration/webhook | Where Facebook sends data |
| Verify Token | a1b2c3d4e5f6g7h8i9j0 | A secret code to verify the connection |
- Click the Copy button next to each value
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โ
- In the left sidebar, look for "Add Product" or scroll down on the dashboard
- Find "Webhooks" in the product list
- Click "Set Up" or "Configure"
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โ
- On the Webhooks page, you'll see a dropdown that says "User" by default
- Change this dropdown to "Page"
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โ
- Click the "Subscribe to this object" button (or "Edit Subscription" if already configured)
- A dialog box will appear asking for two values:
| Field | What to Enter |
|---|---|
| Callback URL | Paste your Webhook URL from the module (e.g., https://yourcrm.com/facebookleadsintegration/webhook) |
| Verify Token | Paste your Verify Token from the module |
- 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:
- You'll see a list of event types under "Page" subscriptions
- Find "leadgen" in the list (you might need to scroll)
- Click the "Subscribe" toggle/checkbox next to "leadgen"
"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?
- Go to your Perfex CRM โ Meta Leads โ Settings
- Click the "Test Connection" button
- You should see all green checkmarks
We'll do more thorough testing later in the Testing Leads section.
Common Mistakes to Avoidโ
| Mistake | Fix |
|---|---|
| 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 HTTPS | Install SSL certificate on your server |
| Typo in the Callback URL | Copy-paste directly from the module settings |
| "Callback URL couldn't be validated" | Check Troubleshooting |
Webhook configured? Connect Your Pages