Odoo
Implementation
Availability |
Odoo Online
Odoo.sh
On Premise
|
Odoo Apps Dependencies |
•
CRM (crm)
• Recruitment (hr_recruitment) • Calendar (calendar) • Contacts (contacts) • Discuss (mail) • Employees (hr) |
Lines of code | 1794 |
Technical Name |
crm_facebook_lead |
License | AGPL-3 |
Website | https://www.lucidbrainz.com |
Availability |
Odoo Online
Odoo.sh
On Premise
|
Odoo Apps Dependencies |
•
CRM (crm)
• Recruitment (hr_recruitment) • Calendar (calendar) • Contacts (contacts) • Discuss (mail) • Employees (hr) |
Lines of code | 1794 |
Technical Name |
crm_facebook_lead |
License | AGPL-3 |
Website | https://www.lucidbrainz.com |
Overview
CRM Facebook Lead Ads Integration by LucidBrainz automatically synchronizes Facebook Lead Ads with your Odoo CRM and HR Recruitment systems. This powerful module eliminates manual data entry by automatically creating leads and job applications from Facebook forms, complete with field mapping, UTM tracking, duplicate detection, and multi-company support. Streamline your lead management process and never miss another Facebook lead again!
Hourly Auto-Sync | Multi-Company | Smart Field Mapping | CRM & HR Support
Key Features
- Automatic Synchronization: Hourly CRON job fetches leads from Facebook Lead Ads API without any manual intervention
- Dual Destination Support: Automatically creates CRM Leads or HR Job Applications based on form configuration
- Intelligent Field Mapping: Map Facebook form fields to any Odoo field with auto-guess functionality for common fields
- Multi-Company Architecture: Perfect data isolation for businesses managing multiple brands or companies
- Complete UTM Tracking: Automatically captures Campaign, Source, Medium, AdSet, and Ad information for ROI analysis
- Advanced Duplicate Detection: Smart detection by Facebook Lead ID, email, and phone number prevents duplicate entries
- Default Mapping Templates: Save time with reusable field mapping templates that auto-apply to new forms
- Organic Lead Detection: Clearly identifies organic vs paid leads for better campaign analysis
- Configurable Sync Window: Set "Fetch Leads After" date to control which leads get synchronized
- Lead Recapture Tracking: Counts and marks recaptured leads when same contact submits multiple forms
How the Module Works
Step 1: Facebook App Configuration
Create Facebook Business App: Go to
developers.facebook.com
and create a new Business application.
Add Lead Ads Product: In your app dashboard, add the "Lead Ads" product
to enable lead form access.
Required Permissions:
• leads_retrieval
- Access lead data
• pages_manage_ads
- Manage page ads
• pages_read_engagement
- Read page engagement
• ads_management
- Manage ads
OAuth Redirect URL: Configure
https://your-odoo-domain.com/crm_facebook_lead/auth
Step 2: Configure Odoo Module
Install Module: Install "CRM Facebook Lead Ads - LucidBrainz" from Odoo
Apps.
Navigate to Settings: Go to
CRM →
Configuration → Facebook Lead Ads Settings
Enter Credentials:
• App ID: Copy from Facebook App Settings → Basic
• App Secret: Copy from Facebook App Settings → Basic
Authenticate: Click "🔑 Authenticate with Facebook" button
• Redirects to Facebook login
• Grant all required permissions
• Access token auto-saved to Odoo
Step 3: Import Facebook Pages & Forms
Import Pages: Click "📥 Import Facebook Pages" button in settings
• All pages where you have admin access are imported
• Each page gets its own access token
• Company assignment can be configured per page
Fetch Lead Forms: Open any imported page and click "Get Forms"
• All active lead forms are automatically imported
• Form questions become field mapping options
• Status tracking ensures only ACTIVE forms sync
Form Configuration:
• Set destination: CRM Lead or HR Applicant
• Assign Sales Team (CRM) or Job Position (HR)
• Configure UTM tracking (Campaign, Source, Medium)
• Set "Fetch Leads After" date to control sync window
Step 4: Smart Field Mapping
Automatic Field Detection: Click "Get Fields" button to fetch all form
questions
• Facebook field keys automatically populated
• Field labels displayed for easy identification
Mapping Options:
1. Manual Mapping: Select Odoo field for each Facebook field
• Supports: char, date, datetime, float, integer, many2one, selection, phone, text
• Search and select from all available fields
2. Auto-Guess Mapping: Click "Guess Mapping" for intelligent
auto-mapping
• Uses default mapping templates
• Matches common fields like full_name → Contact Name
• Saves hours of manual configuration
3. Default Mapping Templates: Create reusable templates in
CRM →
Configuration → Default Field Mappings
• New forms automatically apply these templates
• Standardize mappings across all forms
Step 5: Automatic Lead Synchronization
Scheduled Actions: Two CRON jobs run hourly
• Fetch Facebook Leads (CRM):
model.get_facebook_leads()
• Fetch Facebook Recruitment (HR):
model.get_facebook_recruitment()
Sync Process:
1. Calls Facebook Graph API v7.0 for each configured form
2. Fetches leads with parameters: created_time, field_data, ad
tracking
3. Processes leads with duplicate detection
4. Creates or updates records based on:
• Facebook Lead ID (primary)
• Email address (secondary)
• Phone number (tertiary)
5. Maps fields according to configuration
6. Creates UTM records (Campaign, AdSet, Ad)
7. Commits transaction and processes next page
Error Handling:
• Savepoint for each lead creation
• Continues processing if one lead fails
• Detailed logging for troubleshooting
• Automatic retry on duplicate constraint violations
Step 6: Automated Lead/Applicant Creation
CRM Lead Creation:
• Contact Name: Mapped from full_name or similar field
• Email: Auto-populated from email field
• Phone/Mobile: From phone/mobile fields
• Company: Based on form configuration
• Sales Team: Assigned from form settings
• Campaign/Source/Medium: UTM tracking data
• Facebook Lead ID: Unique identifier
• Facebook Form: Link to source form
• Facebook Page: Source page reference
• Is Organic: Paid vs organic classification
• Created Date: From Facebook timestamp
• Description: Formatted notes with emojis
HR Applicant Creation:
• Applicant Name: From form data
• Job Position: Assigned from form configuration
• Email/Phone: Contact information
• Stage: Initial Qualification stage
• Company: Multi-company support
• Facebook Tracking: Complete ad attribution
• Description: All form responses formatted
Formatted Description: Uses emojis for visual appeal
👤 Contact Name | 📧 Email | 📱 Mobile | 🏙️ City | ✅ Other Fields
Step 7: Intelligent Duplicate Prevention
Three-Level Detection:
Level 1 - Facebook Lead ID (Primary):
• Searches for existing record with same facebook_lead_id
• Most reliable method as Facebook IDs are unique
• Forces database commit to see recent changes
Level 2 - Email Match (Secondary):
• If no Facebook ID match, searches by email_from field
• Updates existing contact with Facebook lead ID
• Prevents duplicate contacts with same email
Level 3 - Phone Match (Tertiary):
• Final check using phone number
• Handles cases where same person uses different email
• Completes the contact deduplication strategy
Update Strategy: When duplicate found:
• Adds missing Facebook Lead ID
• Fills empty email/phone fields
• Assigns company if missing
• Updates UTM tracking data
• Sets facebook_is_organic flag
• Increments existing_lead_count
• Marks as 'Recaptured' lead
Step 8: Complete UTM & Ad Tracking
Automatic UTM Record Creation:
Campaign Tracking:
• utm.campaign
-
Created from campaign_id and campaign_name
• Reuses existing campaign if facebook_campaign_id matches
• Links to crm.lead for reporting
AdSet Tracking:
• utm.adset
-
New model for Facebook AdSet hierarchy
• Tracks adset_id and adset_name from Facebook
• Prevents duplicate AdSet records
Medium/Ad Tracking:
• utm.medium
-
Extended with facebook_ad_id field
• Stores ad_id and ad_name from Facebook
• Links to lead via medium_id field
Complete Attribution Chain:
Campaign → AdSet → Ad → Lead
Enables powerful reporting:
• Which campaigns generate most leads?
• Best performing ad sets?
• Individual ad effectiveness?
• ROI calculation per campaign?
Complete Data Flow Diagram
End-to-End Process:
📱 User Submits Facebook Lead Ad Form
↓
☁️ Facebook Stores Lead in Cloud
↓
⏰ Odoo CRON Runs (Every Hour)
↓
🔍 API Call to Facebook Graph v7.0
GET /form_id/leads?fields=created_time,field_data,ad_tracking
↓
📥 Lead Data Received
{id, created_time, field_data, ad_id, campaign_id, is_organic}
↓
🔎 Duplicate Check (3 Levels)
1. facebook_lead_id → 2. email → 3. phone
↓
✅ New Lead → CREATE | 🔄 Existing → UPDATE
↓
🗺️ Field Mapping Applied
Facebook Fields → Odoo Fields (per configuration)
↓
📊 UTM Records Created/Linked
Campaign → AdSet → Ad
↓
💾 Lead Saved to Database
crm.lead or hr.applicant
↓
📝 Transaction Committed
↓
✨ Lead Visible in Odoo CRM/HR
Processing Time: Leads appear in Odoo within 1-60 minutes depending on
CRON schedule and API response time.
Key Benefits & ROI
✅ Time Savings:
• Eliminates 100% manual data entry
• Saves average 5-10 minutes per lead
• For 100 leads/month = 8-16 hours saved
✅ Data Accuracy:
• Zero transcription errors
• Complete form data captured
• Automatic validation
✅ Marketing ROI Tracking:
• Know exactly which campaigns convert
• Calculate cost per lead by campaign
• Optimize ad spend based on data
✅ Sales Efficiency:
• Leads available in CRM within 1 hour
• Complete contact information ready
• Sales team focuses on calling, not data entry
✅ Multi-Brand Management:
• Perfect for agencies managing multiple clients
• Each brand's leads properly segregated
• No cross-contamination of data
Configuration & Usage Guide
Getting Started
- Install Module: Go to Apps → Search "Facebook Lead" → Install
- Configure Settings: Navigate to CRM → Configuration → Facebook Lead Ads Settings
- Create Facebook App: Visit developers.facebook.com/apps and create Business App
- Enter Credentials: Input your Facebook App ID and App Secret in Odoo
- Authenticate: Click "Authenticate with Facebook" button and grant permissions
- Import Pages: Click "Import Facebook Pages" to sync your pages
Form Configuration
- Access Pages: CRM → Configuration → Facebook Pages
- Get Forms: Open any page and click "Get Forms" button
- Configure Form: Open form and click "Get Fields"
- Set Destination: Choose CRM Lead or HR Applicant
- Map Fields: Match Facebook fields to Odoo fields or use "Guess Mapping"
- Assign Team/Job: Set Sales Team (CRM) or Job Position (HR)
- Set UTM: Configure Campaign, Source, Medium for tracking
- Save: Configuration is ready for automatic sync
Managing Leads
- View CRM Leads: CRM → Leads → Filter by Source = Facebook
- View HR Applications: Recruitment → Applications
- Facebook Info Tab: Check complete Facebook lead details
- UTM Tracking: View Campaign, AdSet, Ad information in Marketing section
- Lead Status: Regular leads, Organic leads, and Recaptured leads clearly marked
User Access Rights
- System Administrators: Full access to configuration and settings
- Sales Managers: Can configure forms and view all leads
- Sales Users: Can view and manage assigned leads
- HR Managers: Full access to recruitment applications
- Multi-Company: Users see only their company's data
Scheduled Actions
- Location: Settings → Technical → Automation → Scheduled Actions
- CRM Sync: "Fetch Facebook Leads (LucidBrainz)" runs every 1 hour
- HR Sync: "Fetch Facebook Recruitment (LucidBrainz)" runs every 1 hour
- Manual Run: Click "Run Manually" to sync immediately
- Customize: Adjust frequency from 1 hour to your preference
Module Screenshots

Step 1: Create a new Business App on Facebook Developer Portal

Step 2: Select "Business" app type for Lead Ads access

Step 3: Fill in app details and create your Facebook application

Step 4: Complete security verification (CAPTCHA)

Step 5: Copy your App ID from the dashboard

Step 6: Go to App Settings → Basic and copy App ID and App Secret

Step 7: Configure module in Odoo with Facebook credentials

Step 8: Configure field mappings - Facebook fields to Odoo fields

Step 9: Automatically created lead in Odoo CRM with formatted description

Step 10: Complete lead details with Business Information and contact data

Step 11: Facebook Info tab showing Lead ID, Page, Form, and tracking details

Step 12: Scheduled action for automatic CRM lead synchronization (runs hourly)

Step 13: Scheduled action for automatic HR recruitment synchronization
Our Services
Odoo
Customization
Odoo
Migration
Support &
Maintenance
📞 Contact Us
WhatsApp:
Email:
Website: |
🌐 Follow Us📘 Facebook 📸 Instagram 💼 LinkedIn 🎥 YouTube |
© 2025 LucidBrainz Infotech | All Rights Reserved | Version 17.0.1.0.0 | License: AGPL-3
Please log in to comment on this module