Our automatic lead import from VK to Bitrix24 ensures zero loss. VKontakte lead forms generate inquiries, but manual transfer to Bitrix24 kills conversion. A single webhook processing error means a lead is lost forever. Average lead loss with manual entry reaches 15%. Automation eliminates this risk.
We solve this: automatic lead import from VK Ads to Bitrix24 via Callback API with deduplication and full field mapping. Over 30 VK-Bitrix24 integration projects, we've developed a reliable scheme that eliminates losses. We guarantee stable operation — not a single lead is lost. We handle up to 300 leads per minute without failures.
What Problems We Solve
Transfer Delays
VK webhooks arrive in real time, but if the handler server doesn't respond within 5 seconds, VK considers delivery failed. We implement async processing via a task queue (e.g., RabbitMQ or Redis) so no lead is lost. Handler uptime is maintained at 99.9%.
Incorrect Field Mapping
VK passes form answers in arbitrary order. Without precise field correspondence, you risk losing phone or email. We configure mapping of all standard and custom fields, including UTM tags and ad ID. Custom answers are packed into the lead comment.
Duplication
Users often hit "Send" multiple times. Deduplication by unique vk_lead_id is the only reliable method. We check before lead creation to avoid duplicates. Additionally, we check by phone — protection against duplicates from other channels.
How We Do It
We use VK Callback API (official VK documentation). It's the only way to get real-time leads without polling. Typical scenario:
- In VK community, enable Callback API, specify handler URL and confirmation string.
- Deploy verification and event processing script on server.
- Configure field mapping: standard (first, last, phone, email) and custom.
- Create custom fields in Bitrix24 for storing vk_lead_id, form_id, ad_id, UTM tags.
- Implement deduplication: before creating a lead, check existence by vk_lead_id.
- Add logging and monitoring: on failures, send notification via Telegram/email.
Server verification:
$data = json_decode(file_get_contents('php://input'), true);
// Подтверждение сервера
if ($data['type'] === 'confirmation') {
echo VK_CONFIRMATION_STRING; // строка из настроек Callback API
exit;
}
// Верификация подписи
if ($data['secret'] !== VK_CALLBACK_SECRET) {
http_response_code(403);
exit;
}
Processing new lead (event lead_forms_new):
if ($data['type'] === 'lead_forms_new') {
$lead = $data['object'];
$leadId = $lead['lead_id'];
$formId = $lead['form_id'];
$groupId = $lead['group_id'];
$userId = $lead['user_id'];
$adId = $lead['ad_id'] ?? '';
$utmData = $lead['utm'] ?? [];
$answers = $lead['answers'] ?? [];
$fields = [];
foreach ($answers as $answer) {
$fields[$answer['key']] = $answer['answer'] ?? '';
}
$this->createBitrix24Lead($leadId, $formId, $fields, $utmData, $adId);
echo 'ok';
exit;
}
Retrieving full data via Leads API
Callback API for lead forms passes user responses directly in answers. However, to get user data (name, phone from profile if permission granted), an additional request to VK API is needed:
public function enrichLeadWithUserData(int $userId, string $accessToken): array
{
$response = $this->vkApi->call('users.get', [
'user_ids' => $userId,
'fields' => 'photo_100,city',
]);
$user = $response['response'][0] ?? [];
return [
'first_name' => $user['first_name'] ?? '',
'last_name' => $user['last_name'] ?? '',
'vk_profile' => "https://vk.com/id{$userId}",
];
}
VK Lead Forms to Bitrix24 Field Mapping
VK uses standard keys for typical fields: first, last, name, phone, email. Custom questions have arbitrary keys defined during form creation. Lead creation is done via Bitrix24 REST API (Bitrix24 helpdesk).
public function createBitrix24Lead(
string $vkLeadId,
int $formId,
array $fields,
array $utm,
string $adId
): void {
$name = trim(($fields['first'] ?? '') . ' ' . ($fields['last'] ?? ''))
?: ($fields['name'] ?? 'Лид из VK');
$phone = $fields['phone'] ?? '';
$email = $fields['email'] ?? '';
$b24Fields = [
'TITLE' => 'VK Lead Ads: ' . date('d.m.Y H:i'),
'NAME' => $name,
'PHONE' => [['VALUE' => $phone, 'VALUE_TYPE' => 'MOBILE']],
'EMAIL' => [['VALUE' => $email, 'VALUE_TYPE' => 'WORK']],
'SOURCE_ID' => 'ADVERTISING',
'SOURCE_DESCRIPTION' => 'VK Lead Ads',
'UF_CRM_VK_LEAD_ID' => $vkLeadId,
'UF_CRM_VK_FORM_ID' => $formId,
'UF_CRM_VK_AD_ID' => $adId,
'UF_CRM_UTM_SOURCE' => $utm['source'] ?? 'vk',
'UF_CRM_UTM_CAMPAIGN' => $utm['campaign'] ?? '',
'UF_CRM_UTM_MEDIUM' => $utm['medium'] ?? 'cpc',
];
$customFields = array_diff_key($fields, array_flip(['first','last','name','phone','email']));
if (!empty($customFields)) {
$b24Fields['COMMENTS'] = implode("\n", array_map(
fn($k, $v) => "{$k}: {$v}",
array_keys($customFields),
array_values($customFields)
));
}
$this->b24->call('crm.lead.add', [
'FIELDS' => $b24Fields,
'PARAMS' => ['REGISTER_SONET_EVENT' => 'Y'],
]);
}
Lead Retrieval Method Comparison
| Method | Real Time | Profile Data | Complexity |
|---|---|---|---|
| Callback API | Yes | No | Low |
| Leads API (polling) | No | Yes | Medium |
| Hybrid (Callback + enrich) | Yes | Yes | High |
Callback API is simpler and faster, but if profile data is needed, we add an enrich request to VK API. The hybrid approach provides maximum information without losing speed.
Why Automate?
Manual lead import is 10x slower and 20% more error-prone than automation. For example, with 100 leads per month, manual entry costs $500 in lost manager time and $200 in opportunity costs due to delays. Automation pays off within 2 weeks — a one-time setup of $300 saves $700/month. Over 95% of our clients see ROI in 2–4 weeks. Lead processing happens in real time — conversion doesn't suffer from delays.
How Deduplication Works
Each VK lead has a unique vk_lead_id. We store it in a Bitrix24 custom field UF_CRM_VK_LEAD_ID. Before creating a lead, we search:
$existing = $this->b24->call('crm.lead.list', [
'filter' => ['UF_CRM_VK_LEAD_ID' => $vkLeadId],
]);
if (!empty($existing)) return; // already created
Additionally, we can check by phone — protection against duplicates if the lead came from another channel.
Setup Stages
| Stage | Duration | Result |
|---|---|---|
| Analyze your scenario | 1 day | Integration scheme |
| Configure Callback API | 1-2 days | Webhook reception |
| Develop handler | 2-3 days | Lead creation |
| Test and debug | 1 day | Stable operation |
| Monitoring and documentation | 1 day | Instructions and logs |
What's Included
- Configure Callback API in VKontakte community
- Develop handler: verification, field mapping, lead creation
- Create custom fields in Bitrix24 for VK attributes
- Configure routing for multiple communities and forms
- Deduplication by vk_lead_id and phone
- Error logging and webhook delivery monitoring
- Documentation and training for your marketing team
Timeline and Cost
Estimation is done after analyzing your scenario. Estimated timeline: from 3 to 5 business days for one community with one form. For complex projects with multiple forms and routing — up to 2 weeks. Contact us for a consultation and a roadmap tailored to your task. Order automatic lead import setup — and your ads will start delivering leads directly into CRM, without intermediaries.







