| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
CRM (crm)
• Calendar (calendar) • Contacts (contacts) • Discuss (mail) |
| Community Apps Dependencies | Show |
| Lines of code | 11127 |
| Technical Name |
d_crm_meta_lead_ads |
| License | OPL-1 |
| Website | https://duong-odoo-apps.odoo.com |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
CRM (crm)
• Calendar (calendar) • Contacts (contacts) • Discuss (mail) |
| Community Apps Dependencies | Show |
| Lines of code | 11127 |
| Technical Name |
d_crm_meta_lead_ads |
| License | OPL-1 |
| Website | https://duong-odoo-apps.odoo.com |
CRM Meta Lead Ads
Connect Facebook and Instagram Lead Ads with Odoo CRM. Manage ad accounts, campaigns, lead forms, and creatives from Odoo. Import lead submissions in near real time via webhook and scheduled polling. Track every imported lead back to its Meta form, platform, and campaign.
Rich Meta Ads Dashboard
The Meta Ads Overview dashboard gives a live picture of ad performance and CRM results without leaving Odoo.
- 9 KPI cards â Total Spend, Leads (CRM), Cost per Lead, Impressions, Reach, Clicks, CTR, Results, Cost per Result.
- Filter by 7 / 30 / 90-day period and by ad account.
- Spend & Results over time â full-width line chart from synced Meta insights.
- Leads over time â bar chart from CRM leads.
- Leads by Platform â doughnut chart (Facebook vs Instagram).
- Top 5 Campaigns by Spend â horizontal bar chart and summary table.
- Sync Now button pulls fresh data from Meta on demand.
Connect Meta Account
Use the existing Facebook social account connection, then authorize Lead Ads access from the Meta Lead Ads tab. Subscribe the page to the shared webhook URL and sync lead forms in one flow.
Ad Accounts and Structure Sync
Connect ad accounts synced from Meta or enter sandbox accounts manually. Use Sync Structure to pull campaigns, ad sets, ads, creatives, and lead forms. Use Sync Insights to pull daily ad performance metrics.
Lead Form Configuration
Create or sync Meta lead forms in Odoo. Configure import mode (Lead or Opportunity), sales team, salesperson, tags, privacy URL, and follow-up URL. Map Meta question keys to Odoo CRM fields. Preview the form in mobile view before publishing.
Preview Lead Form
Preview the lead form in mobile/desktop view before publishing.
Real-Time Lead Import
Leads submitted on Meta forms are queued via the shared Facebook webhook and processed into CRM within minutes. A scheduled polling job recovers any missed webhook notifications. Every import creates a log row with Created, Duplicate, Pending, or Error status.
Recent Leads and CRM Origin
Browse all Meta-sourced CRM leads in a dedicated list view. Each lead stores Meta platform (Facebook or Instagram), the originating lead form, Meta lead ID, campaign references, UTM source, team, and salesperson directly on the opportunity record.
Campaign Creation Wizard
Build a complete campaign chain from Odoo in a guided five-step wizard: Account â Campaign â Ad Set â Creative â Review. Delivery objects are created paused by default so you can review before spend begins.
Preview Ads
Preview your Meta ads in a dedicated view before publishing. Ensure your ads look great across all devices and platforms.
What This Module Delivers
- Connect Meta page and ad account access from Odoo using the existing Facebook social account infrastructure.
- Sync Meta ad accounts, campaigns, ad sets, ads, creatives, lead forms, audiences, and insights.
- Create lead forms and paused campaign chains from Odoo using a guided wizard.
- Receive leadgen webhook notifications through the shared Facebook webhook endpoint.
- Poll missed lead submissions on a schedule for resilience.
- Import submissions as CRM leads or opportunities based on per-form configuration.
- Track whether each CRM record came from Facebook or Instagram.
- Assign imported leads to native Odoo CRM teams and salespeople.
- Rich OWL dashboard with KPI cards, trend charts, platform breakdown, and top-campaign analysis.
- Review insights, recent leads, and import logs from within the Meta Ads app.
Documentation
Please open the Documentation tab on the right side of this page to see how to configure the Facebook developer app and the Odoo integration step by step.
Support
Have questions or need assistance? Contact us at duongodooapps@gmail.com.
Meta Lead Ads for Odoo - User Guide
This module connects Meta Lead Ads with Odoo CRM. It lets sales and marketing teams connect a Meta account, manage lead forms and campaign objects inside Odoo, import Facebook and Instagram lead submissions into CRM, and report on the source and status of imported leads.
Customer Requirement Coverage
| Requirement | Module Support |
|---|---|
| Connect your Meta account to Odoo | Uses the existing Facebook social account connection, then adds Lead Ads authorization, ad account sync, page webhook subscription, and Meta app credentials from Odoo settings. |
| Auto-fetch leads from Facebook ad forms into Odoo CRM in real time | Uses the shared Facebook webhook endpoint for Meta leadgen notifications and a scheduled polling job for missed leads. Imported submissions are deduplicated by Meta lead ID. |
| Manage campaigns and lead forms inside Odoo | Provides Odoo menus for ad accounts, campaigns, ad sets, ads, creatives, custom audiences, insights, lead forms, and import logs. |
| Choose whether to download from Meta as lead or opportunity | Each lead form has an Import As field. Submissions can create either Lead or Opportunity records. |
| See whether the CRM record came from Facebook or Instagram | CRM leads store Meta platform, lead form, Meta lead ID, and UTM source where available. |
| Assigned and unassigned leads must follow proper Odoo team visibility | Imported records use native crm.team and res.users assignment fields, so normal Odoo CRM security and sales team visibility apply. |
| Rich Meta Ads dashboard | Adds a rich OWL dashboard with 9 KPI cards (spend, leads, CPL, impressions, reach, clicks, CTR, results, cost/result), spend and leads trend charts, platform doughnut chart, top-campaign bar chart and table — plus graph, pivot, recent leads, insights, and import log views. |
Quick Start
- Install d_crm_meta_lead_ads and its dependencies.
- Configure the Facebook app ID and app secret in Odoo.
- Connect the Facebook page account.
- Authorize Lead Ads access from the connected social account.
- Sync ad accounts and lead forms.
- Configure each lead form: import mode, team, salesperson, tags, and field mappings.
- Subscribe the page to the shared webhook URL.
- Create a test lead from Meta or Odoo, then run Sync Leads Now.
- Confirm the CRM record appears with Meta origin, platform, team, and source.
- Use the OWL dashboard (KPI cards, charts, top-campaign table) and import logs to verify results.
Prerequisites
Facebook Marketing API Connector Setup
This guide explains the extra steps needed to enable Facebook Marketing App (meta ads) in Odoo, on top of the base Facebook Pages setup from the d_social_facebook module.
Prerequisites
- Facebook Business app already created on Facebook for Developers https://developers.facebook.com/
- Facebook Pages integration configured in Odoo (see https://apps.odoo.com/apps/modules/18.0/d_social_facebook).
1. Add Marketing Product
- Open your app in Facebook for Developers https://developers.facebook.com/
- In Products, click Add product.
- Add Marketing.
Example:
2. Configure Webhook Callback URL
In the Messenger product, go to Messenger > Settings.
Under Webhook / Callback URL, set:
Callback URL:
https://your-odoo-domain.com/social_facebook/webhook
Verify Token: use the shared Facebook webhook verify token from Odoo.
In Odoo, go to the Facebook settings and copy the shared Facebook webhook URL and verify token.
Back in Facebook, click Verify and Save to validate the callback URL.
Register Leadgen webhook
Example configuration:
3. App Mode and Review
For real users to send and receive messages through your app:
- The app must be switched to Live mode.
- You should request the required permissions for Messenger in App Review > Requests, otherwise only developers, testers and the Page owner can use the integration.
Connect Meta Account
- Open the connected Facebook social account in Odoo.
- Confirm the page ID and page access token are present.
- Click the Lead Ads connection action.
- Complete Meta OAuth.
- Return to Odoo and confirm Lead Ads is enabled.
- Click the webhook subscription action to subscribe the page to leadgen.
- Sync lead forms.
The page webhook subscription uses the shared Facebook webhook URL:
https://your-odoo-domain/social_facebook/webhook
Sync Ad Accounts and Structure
Open Meta Ads / Configuration / Ad Accounts.
Use:
- Sync Structure to pull campaigns, ad sets, ads, creatives, lead forms, and related IDs.
- Sync Insights to pull reporting data.
- Manual ad account creation when using a sandbox account that is not returned by the normal account list.
Lead Forms
Lead forms are the main configuration point for CRM import.
Important fields:
- Account: connected Meta page/social account.
- Form ID: Meta lead form ID after creation or sync.
- Import As: choose Lead or Opportunity.
- Sales Team: native Odoo CRM team for visibility and assignment.
- Salesperson: optional default owner.
- Tags: optional CRM tags for imported records.
- Privacy Policy URL: required by Meta for form creation.
- Follow Up Action URL: used by the completion screen View website button.
- Questions: form fields shown to the user.
- Field Mappings: maps Meta question keys to Odoo crm.lead fields.
Question Management
Standard question types include:
- Full name
- First name
- Last name
- Phone number
- Company name
- Job title
- City
- State
- Country
- Zip code
- Custom question
Manual question rows are preserved during sync. If Meta does not echo a manually added question immediately, the Odoo row should remain visible.
Lead Form Preview
The preview wizard approximates Meta's mobile lead form experience with three steps:
- Contact questions
- Privacy step
- Completion step
The completion step shows Thanks, you're all set. and a View website button when Follow Up Action URL is configured.
Lead Form Updates
Meta lead forms are only safely updateable while they are draft. Once Meta locks or publishes a form, Odoo hides the normal update action.
If a form is no longer draft:
- Use New Version in Odoo.
- Review copied questions, mappings, team, salesperson, tags, privacy URL, and follow-up URL.
- Create the new form on Meta.
- Use the new form in new creatives or ads.
Create Test Lead and Import
Use Meta's Lead Ads Testing https://developers.facebook.com/tools/lead-ads-testing/ Tool or the Odoo test lead action where available.
After creating a test lead:
- Open the lead form.
- Click Sync Leads Now.
- Open Import Logs.
- Confirm a log row is created.
- Open the linked CRM lead or opportunity.
- Run sync again to confirm duplicate protection.
Campaign Creation Wizard
Use Meta Ads / Create Campaign to create a complete campaign chain.
The wizard covers:
- Ad account and page selection.
- Campaign objective, buying type, budget mode, and campaign status.
- Ad set targeting, destination, schedule, budget, optimization, and promoted object.
- Creative content, call to action, image, and lead form.
- Review and publish.
The recommended operating mode is to create delivery objects as Paused first, then review the complete chain before activation.
Campaigns, Ad Sets, Ads, and Creatives
The module stores Meta object IDs and supports actions for create, update, sync, refresh status, preview, and insights where Meta permits the operation.
For campaign and ad set budgets:
- Campaign budget optimization means some ad set fields cannot be changed later.
- Ad set budget mode allows more ad set-level budget edits.
- If Meta rejects an update, Odoo should show the Meta error message, code, and trace ID where available.
Ads Preview
The module requests real preview iframe HTML from Meta's Marketing API.
If the preview returns:
No permission to access this profile
the API call succeeded, but the browser rendering the iframe is not logged into a Facebook account with permission to view the page, Instagram profile, ad account, or creative. Odoo cannot bypass this because the iframe is served by business.facebook.com and uses the browser's Facebook session.
Lead Capture and CRM Import
Lead capture uses two paths:
- Webhook notification for near real-time queueing.
- Polling cron for missed leads and recovery.
The webhook gives IDs only. Odoo then calls Meta to retrieve full lead data such as field values, platform, ad ID, campaign ID, and timestamps.
Import logic:
- Find the Odoo lead form by Meta form ID.
- Check duplicate by Meta lead ID.
- Retrieve full lead data from Meta.
- Apply field mappings.
- Create a CRM lead or opportunity.
- Assign team, salesperson, tags, source, platform, and Meta origin.
- Write an import log.
CRM Origin
Imported CRM records include a Meta origin section.
Typical fields:
- Meta Lead ID
- Platform: Facebook or Instagram
- Meta Lead Form
- Meta Campaign or ad references when available
- UTM source and medium
- Team and salesperson
Dashboard and Reporting
The Meta Ads Overview dashboard is a rich OWL client-action view with:
- 9 KPI cards (Total Spend, Leads (CRM), Cost per Lead, Impressions, Reach, Clicks, CTR, Results, Cost per Result) — filterable by 7 / 30 / 90-day period and by ad account.
- Spend & Results over time — full-width line chart from meta.ad.insight (campaign level).
- Leads over time — bar chart from crm.lead (Meta-sourced).
- Leads by Platform — doughnut chart (Facebook vs Instagram).
- Top 5 Campaigns by Spend — horizontal bar chart and detail table (Campaign, Spend, Impressions, Clicks, CTR, Results, CPL).
- Sync Now button — calls the existing meta.ad.account.action_sync_insights to pull fresh data.
- Insights and Leads shortcut buttons to drill-down views.
Available reporting views include:
- Dashboard
- Recent Leads
- Leads by Platform
- Leads by Form
- Import Logs
- Insights
- Campaigns
- Ad Sets
- Ads
- Creatives
Scheduled Jobs
| Job | Interval | Purpose |
|---|---|---|
| Meta Lead Ads: Process webhook queue | Every 5 minutes | Processes pending leadgen webhook queue rows. |
| Meta Lead Ads: Poll missed leads | Every 15 minutes | Pulls recent leads from active forms to recover missed webhooks. |
| Meta Lead Ads: Refresh tokens | Daily | Refreshes supported token data where the underlying Facebook module allows it. |
| Meta Ads: Sync insights | Daily | Pulls Meta Ads insights for configured ad accounts. |
Security and Access
The module uses normal Odoo security patterns:
- Managers configure Meta accounts, forms, ads, campaigns, audiences, and mappings.
- CRM users see leads according to existing CRM lead, team, and salesperson rules.
- Imported records use native team_id and user_id fields.
- Persistent Meta models support chatter and activities for audit and follow-up.
Troubleshooting
OAuth Redirect Mismatch
Confirm the Meta app OAuth redirect URI exactly matches:
https://your-odoo-domain/meta_lead_ads/authentication
Meta Account Connects but Ad Account Sync Fails
Check:
- The user has access to the ad account.
- The app has ads_read or ads_management.
- The ad account is not disabled.
- Sandbox ad accounts may require manually entering the ad account ID and using a token with the correct sandbox access.
Missing leads_retrieval
If Meta returns permission error code 200 for lead retrieval, authorize the Lead Ads scope again and confirm the connected user has page access. For production users, Meta app review may be required.
Webhook Verification Fails
Use the shared callback URL:
https://your-odoo-domain/social_facebook/webhook
Confirm the verify token in Meta App Dashboard matches the Odoo Facebook webhook verify token.
Webhook Is Verified but Leads Do Not Import
Check:
- Page is subscribed to the leadgen field.
- The Odoo form exists with the same Meta form ID.
- The lead form is active in Odoo.
- The webhook queue cron is active.
- Import logs show pending, duplicate, created, or error state.
- The page token has leads_retrieval access.
Test Lead Already Exists
Meta allows one test lead per form until the previous test lead is deleted. If delete fails because of permissions or Meta sandbox behavior, use Meta's Testing Tool to remove the old test lead, or create a new form version and test with that form.
Lead Form Cannot Be Updated
Meta locks most lead forms after draft/publish state. Use New Version in Odoo instead of editing the locked Meta form.
Ad Preview Shows No Permission
The preview iframe is served by Meta Business Manager. The Odoo API token may be valid, but the browser viewing the iframe also needs Facebook permissions. Log into Facebook Business Manager in the browser with a user that can access the page, Instagram profile, ad account, and creative.
Ad Set Update Fails with Budget Sharing Message
Meta restricts some ad set spec changes when campaign budget sharing is enabled. Change only mutable fields, or create a new ad set under the campaign.
Recommended Customer Acceptance Test
- Connect the Meta account.
- Sync one sandbox or real ad account.
- Create one lead form with full name, email, phone, privacy URL, and follow-up URL.
- Configure it to import as Lead.
- Submit one test lead.
- Sync leads and confirm a CRM lead is created.
- Sync again and confirm no duplicate is created.
- Create a second form version configured as Opportunity.
- Submit another test lead and confirm an opportunity is created.
- Confirm source shows Facebook or Instagram.
- Confirm team visibility by logging in as users from different CRM teams.
- Open dashboard, recent leads, insights, and import logs.
- Create a paused campaign chain from the wizard.
- Confirm Meta IDs are stored for campaign, ad set, creative, lead form, and ad.
Support Notes
Keep the exact Meta error response when reporting issues. The most useful fields are:
- Error message
- Error code
- Error subcode
- error_user_title
- error_user_msg
- fbtrace_id
These values make it possible to separate Odoo configuration problems from Meta permission, app review, sandbox, and business account restrictions.
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module