Automatic lead import from Facebook Lead Ads to Bitrix24

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Showing 1 of 1All 1626 services
Automatic lead import from Facebook Lead Ads to Bitrix24
Simple
~1 day
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1361
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    948
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    695
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    834
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    732
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1075

Automatic Lead Import from Facebook Lead Ads to Bitrix24

Losing leads from Facebook Lead Ads? Manual CSV export causes a delay of 30 minutes to a day. In that time, competitors snatch the client: the chance of a successful call drops 10-fold just 5 minutes after form submission. Each lost lead is missed revenue that can amount to thousands of rubles. Our integration delivers the lead to CRM in 1–2 seconds. You get a hot contact instantly, not when it has gone cold.

Automation solves this problem entirely: eliminates human error, copy-paste mistakes, and missed leads. We are certified Bitrix specialists with 10+ years of experience and over 50 successful integrations. Below is exactly how we do it and the process we follow.

Automation Import: Manual vs. Automated

Criteria Manual CSV Automated Webhook
Delivery speed 30 minutes to 1 day 1–2 seconds
Error handling Manual Logging and retries
Deduplication None By phone/email
Time spent 15 minutes per day 0 minutes

Automation reduces lead processing time from 30 minutes to 2 seconds — 900 times faster. Bonus: full transparency — every lead is tracked, errors are logged and alerted.

How the Facebook Lead Ads Webhook Works

Facebook sends Lead Gen Webhooks — push notifications about new leads. Delay is no more than 1–2 seconds. The process consists of three stages: webhook setup, verification, and processing.

Webhook Setup:

  1. In Facebook Developers, create an app and enable leads_retrieval and pages_manage_metadata permissions.
  2. In the webhook settings, specify the URL and Verify Token.
  3. Subscribe to the leadgen event for the relevant page.

Webhook Verification (GET request):

if ($_GET['hub_mode'] === 'subscribe' &&
    $_GET['hub_verify_token'] === FB_VERIFY_TOKEN) {
    echo $_GET['hub_challenge'];
    exit;
}

Incoming Lead Processing (POST request):

$payload = json_decode(file_get_contents('php://input'), true);
$signature = 'sha256=' . hash_hmac('sha256',
    file_get_contents('php://input'),
    FB_APP_SECRET
);
if ($signature !== $_SERVER['HTTP_X_HUB_SIGNATURE_256']) {
    http_response_code(403);
    exit;
}
foreach ($payload['entry'] as $entry) {
    foreach ($entry['changes'] as $change) {
        if ($change['field'] === 'leadgen') {
            $leadgenId = $change['value']['leadgen_id'];
            $formId    = $change['value']['form_id'];
            $adId      = $change['value']['ad_id'];
            $campaignId = $change['value']['campaign_id'];
            $leadData = $this->getLeadData($leadgenId);
            $this->createBitrix24Lead($leadData, [
                'ad_id'       => $adId,
                'campaign_id' => $campaignId,
                'form_id'     => $formId,
            ]);
        }
    }
}
http_response_code(200);

Retrieving Lead Data via Graph API

The webhook only sends leadgen_id. Full data is fetched separately:

public function getLeadData(string $leadgenId): array
{
    $response = $this->fbGraph->get(
        "/{$leadgenId}?fields=field_data,created_time,ad_id,form_id",
        $this->pageAccessToken
    );
    $lead = $response->getDecodedBody();
    $fields = [];
    foreach ($lead['field_data'] as $field) {
        $fields[$field['name']] = $field['values'][0] ?? '';
    }
    return [
        'name'        => $fields['full_name']   ?? $fields['first_name'] . ' ' . $fields['last_name'],
        'phone'       => $fields['phone_number'] ?? $fields['phone'] ?? '',
        'email'       => $fields['email']        ?? '',
        'custom'      => $fields,
        'created_at'  => $lead['created_time'],
    ];
}

Field names in Facebook Lead Ads depend on form configuration — standard fields are full_name, email, phone_number; custom ones are arbitrary. Mapping is configured per form.

Creating a Lead in Bitrix24

public function createBitrix24Lead(array $leadData, array $fbMeta): void
{
    $fields = [
        'TITLE'      => 'Facebook Lead Ads: ' . date('d.m.Y H:i'),
        'NAME'       => $leadData['name'],
        'PHONE'      => [['VALUE' => $leadData['phone'], 'VALUE_TYPE' => 'WORK']],
        'EMAIL'      => [['VALUE' => $leadData['email'], 'VALUE_TYPE' => 'WORK']],
        'SOURCE_ID'  => 'WEB',
        'SOURCE_DESCRIPTION' => 'Facebook Lead Ads',
        'UF_CRM_FB_AD_ID'       => $fbMeta['ad_id'],
        'UF_CRM_FB_CAMPAIGN_ID' => $fbMeta['campaign_id'],
        'UF_CRM_FB_FORM_ID'     => $fbMeta['form_id'],
        'UF_CRM_FB_LEAD_TIME'   => $leadData['created_at'],
    ];
    if (!empty($leadData['custom'])) {
        $customText = implode("\n", array_map(
            fn($k, $v) => "{$k}: {$v}",
            array_keys($leadData['custom']),
            array_values($leadData['custom'])
        ));
        $fields['COMMENTS'] = $customText;
    }
    $this->b24->call('crm.lead.add', [
        'FIELDS' => $fields,
        'PARAMS' => ['REGISTER_SONET_EVENT' => 'Y'],
    ]);
}

Delivery Reliability

Facebook webhooks sometimes fail due to network issues or platform outages. A backup mechanism polls every 30 minutes via GET /{page_id}/leadgen_forms/{form_id}/leads?since={timestamp}. All errors are logged, and we configure alerts. We guarantee no lead is lost.

The retry mechanism works as follows: on error from Bitrix24 (5xx, timeout), the incoming request is saved to a temporary table marked as "unprocessed". A separate cron agent every 10 minutes picks up unprocessed records and retries lead creation. The cycle continues until success or 24 hours have passed — after that, the error is logged to a file and an alert is sent to the responsible email.

Logging and Monitoring

Without monitoring, a failure could go unnoticed for hours. We configure:

  • Logging of every incoming webhook to a table with fields: date, leadgen_id, status (ok/error), Bitrix24 response text.
  • Dashboard in Bitrix24: number of leads created from Facebook per day/week per form.
  • Email alert if no Facebook leads appear during business hours for more than 2 hours.

Transparency allows quick identification of the cause — webhook disabled on Facebook side, page token expired, or server issue.

Deduplication

Without deduplication, one client can submit multiple requests, cluttering the CRM. We set up duplicate search by phone or email. If a lead already exists, no new one is created — only the current one is updated. This is especially important for retargeting campaigns where a user sees an ad multiple times and fills the form again. Additionally, on repeat contact, a record with the campaign name and date is automatically added to the timeline of the existing lead — the manager sees the full touch history without manual search.

Criteria Without Dedup With Dedup
Duplicates in CRM 15% of leads <0.5%
Manual cleanup time 2 hours per week 0 minutes
Analytics accuracy Low High

What’s Included

  • Creation of Facebook App and setup of leads_retrieval permissions.
  • Webhook configuration for Lead Ads pages.
  • Development of the handler: verification, Graph API, field mapping.
  • Creation of custom fields in Bitrix24 for Facebook attributes.
  • Deduplication by phone/email.
  • Backup polling and error logging.
  • Documentation and training for your team.

Our engineers hold Bitrix certification and have 10+ years of integration experience. We guarantee stable operation and provide post-launch support.

Timeline: 1 to 2 weeks (including Facebook App moderation). Cost is calculated individually.

More about webhooks — Facebook Lead Ads Webhooks.

We will evaluate your project within one day. Contact us to get a consultation and cost estimate. Order automated lead import setup today.

How to ensure CRM implementation success?

We have been working with Bitrix24 for over 10 years — during that time we have completed 500+ projects. Every second one starts with the same problem: a company buys CRM, sets it up "by the book," and three months later managers fill two out of twelve fields, deals stall at "Negotiations" for months, and management cannot extract analytics. The root is not bad software — it's the approach. CRM is configured without auditing real processes, without considering staff objections, and without a step-by-step automation plan. In this article — a step-by-step guide on how we avoid this.

All specialists are certified by 1C-Bitrix, the methodology is proven on hundreds of cases. 1C-Bitrix is a platform that, when paired with Bitrix24, provides real end-to-end analytics if configured correctly.

Reality of CRM implementations: 80% fail to deliver results

Why do employees sabotage CRM?

Managers are accustomed to Excel and notepads — they perceive CRM as total control. Our solution: involve key employees at the design stage, show personal benefits — automatic reminders, ready-made proposal templates, less routine. We train on real scenarios, not abstract examples. Resistance drops 4 times faster than with "command" implementation.

How to prevent incomplete data entry?

Mandatory fields are filled, others are ignored — familiar picture? We solve it on three levels:

  • Set mandatory fields per funnel stage (only relevant data at each stage).
  • Implement auto-fill from UTM tags, email parsing, data from open databases.
  • Remove redundant fields — fewer fields, higher quality.

According to our practice, field optimization reduces omission rates by 70% within the first month.

How to design funnels correctly?

Too many stages, no transition criteria, duplicate stages — typical mistakes. We design the funnel based on reality: how sales actually work, not as written in textbooks. We use CRM data from the first 2 weeks of audit to identify real stages and loss points. This shortens the deal cycle by 25–40%.

What automation should be done first?

We set up robots and business processes from day one — so the team immediately feels the difference. For example, lead distribution, sending emails after status changes, creating tasks for colleagues. Companies that implement automation at the start achieve plan targets 3 months faster.

What Bitrix24 features accelerate sales?

  • Inquiries from all channels (phone, email, messengers, forms) are captured automatically.
  • Leads are created and distributed without manual intervention.
  • Visual kanban with custom stages — drag a card to the next stage, an email is sent automatically, a task is created.
  • Omnichannel: unified window for telephony, email, WhatsApp, Telegram, Viber, VK, Instagram, online chat.
  • Robots and business processes: mailings, document generation, reminders, escalations — no coding required.
  • Analytics: funnel, conversions, lead sources, manager workload, average handling time.

What does integrating a 1C-Bitrix website with Bitrix24 CRM provide?

Synergy of the two products yields measurable results, and we implement it through direct data exchange. Site forms transfer leads to CRM instantly with full UTM markup — you see where the client came from. Online chat connects via open lines: a visitor writes on the site, the manager responds from CRM. Orders in the store based on infoblocks v2.0 become deals with full purchase history, enabling cross-selling. Call tracking with number substitution links calls to advertising channels. We use CommerceML to exchange data with 1C Trade Management/ERP: nomenclature, stock balances, prices — synced via agents without manual intervention. End-to-end analytics collects advertising costs, visits, leads, sales in one report — ROI per channel. For non-standard logic, we use REST API and high-load blocks to store arbitrary data (e.g., tech support interaction history). In one project, we configured this bundle for a retail chain: 1C cash register integration with CRM created contacts automatically upon loyalty card purchase, and CRM marketing via Bitrix24 increased repeat purchases by 18% in six months.

How we set up CRM: the process

  1. Audit. We analyze how sales work currently. Where are leads lost? Which channels bring clients? We form recommendations before technical implementation.
  2. Design. Multiple funnels for different directions, custom fields, mandatory stages and transition conditions. Structure reflects the real process.
  3. Integrations. Connect to website, telephony, email, messengers, Yandex.Direct, Google Ads, 1C.
  4. Custom modules. When standard is not enough — applications for Bitrix24: specific reports, non-standard business logic, integrations with industry systems.
  5. Migration. Transfer databases from amoCRM, Megaplan, Salesforce, HubSpot, Excel. Relationships, communication history, attachments — everything intact.
  6. Training. Trainings tailored to your configuration, video instructions, documentation.

What is included in the work?

Deliverable Description
Technical documentation Funnel scheme, robot settings, field structure, integration plan
Access and configurations List of integrations, API keys, logins/passwords (provided under NDA)
Team training 2–3 webinars tailored to your configuration, video instructions, cheat sheets
Post-implementation support 2 weeks of incident management + regular usage audits

Cloud or on-premise: which to choose?

Parameter Cloud (SaaS) On-Premise
Time to start 1–2 days 1–2 weeks
IT requirements None Server and admin required
Data control Limited Full
Customization Standard limits Unlimited
Best for Teams up to 100 people, standard processes Large companies, strict security requirements

Comparison: the cloud version is 2–3 times cheaper initially, but for B2B companies with large data volumes, on-premise pays off in 1.5–2 years due to no per-user subscription fee.

Metrics we track for your business

  • Funnel stage conversion. If 80% are lost at the proposal stage — the problem is pricing, not managers. Norm: 5–15% for B2B, 1–5% for high-ticket B2C.
  • Lead response time. A 5-minute response increases conversion 10x compared to a 30-minute response. We set alerts — if a manager doesn't respond within 15 minutes, the lead is reassigned.
  • LTV. CRM segments clients by lifetime value — managers focus on the most valuable.
  • Average deal cycle. If it increases, something is broken. Reasons for rejections are gold for product and script adjustments.

Our case studies

Manufacturing company (B2B). A plant with high annual turnover. Leads were lost in email; management only learned about large deals post-factum. We set up automatic inquiry capture, a funnel "qualification → calculation → proposal → approval → contract → payment," and robots that generate proposals from templates. Conversion increased by 23%, lead processing time dropped from 4 hours to 20 minutes. Manager payroll savings exceeded $1,000 per month due to reduced routine.

IT service company. Three funnels: new clients, upselling, tenders. Auto-generation of contracts and invoices, integration with Jira — after signing, tasks automatically appear in the development department. Management received a weighted revenue forecast with 90% accuracy. The project paid off in 4 months.

Implementation timeline and cost

Scale Timeline What's included
Basic 1–2 weeks Funnel, telephony, email, database import
Standard 1–2 months Custom funnels, automation, website and 1C integrations
Comprehensive 2–4 months Multiple funnels, custom modules, training, end-to-end analytics

The cost is calculated individually based on your scope of work. After implementation — tech support with SLA (response from 1 hour), regular usage audits, and feature development.

Ready to discuss your situation? Contact us — we'll conduct a free audit of your current CRM within 2 days and propose an implementation architecture with a result guarantee. Request a consultation — we'll show you in numbers how much you'll save with proper setup.