VK Bot Development with Bitrix24 Integration

A user writes to a VK group chat — the bot replies, qualifies the lead, and creates a deal in Bitrix24. A typical problem: managers waste time on initial qualification, leads are lost due to slow response. The solution is a bot that processes requests 24/7. We have been developing such bots for over

Our competencies:

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1415
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    995
  • 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
    733
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    863
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    772
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1134

A user writes to a VK group chat — the bot replies, qualifies the lead, and creates a deal in Bitrix24. A typical problem: managers waste time on initial qualification, leads are lost due to slow response. The solution is a bot that processes requests 24/7. We have been developing such bots for over 5 years and know all the pitfalls. This is not just an auto-responder: the conversation is saved in CRM, the manager sees the correspondence in the lead card and can reply directly from B24. We guarantee stable bot operation thanks to our experience in integrating VK API and Bitrix24 REST.

According to the VK API documentation, the Callback API guarantees event delivery with server confirmation.

Two Ways to Integrate VK with Bitrix24

Method 1: Bitrix24 Open Lines. B24 has a native VK connector. It is enabled in the open lines settings (imopenlines) and works "out of the box" if your tariff includes this feature. Limitations: text and attachments only, no programmable bot logic, no branched auto-reply scenarios.

Method 2: Custom Integration via VK API. A bot on your server receives messages from VK via Callback API or Long Poll, processes them with your own logic, and communicates with B24 via REST API. Full control over behavior.

Why a Custom Bot Is 3 Times Better Than Open Lines?

Open Lines handle only simple requests. A custom bot can qualify leads, show menus, process photos and voice messages. In tests, conversion to deal with a custom bot is 30% higher — due to instant response and personalization. No "call back later". Sales automation with a custom bot reduces lead response time from hours to seconds.

How FSM Prevents Losing Dialog Context?

FSM (Finite State Machine) stores dialog state. The conversation scenario is implemented by storing state in Redis. For example, at start the bot shows a menu, waits for a choice, then requests a phone number and creates a lead. Loss of state is eliminated.

{ "type": "message_new", "object": { "message": { "from_id": 123456789, "text": "Hello, how to order?", "id": 987 } }, "group_id": 111222333 } 
<?php // Dialog state stored in Redis: state:{vk_user_id} $state = $redis->get("vk_dialog:{$userId}"); switch ($state) { case null: sendVkMessage($userId, "Hello! Do you want:\n1. Know the price\n2. Leave a request\n3. Contact a manager"); $redis->set("vk_dialog:{$userId}", 'menu', 3600); break; case 'menu': if ($text === '2' || stripos($text, 'request') !== false) { sendVkMessage($userId, "Enter your phone number:"); $redis->set("vk_dialog:{$userId}", 'await_phone', 3600); } break; case 'await_phone': if (isValidPhone($text)) { createLeadInB24($userId, $phone); sendVkMessage($userId, "Thank you! A manager will contact you within an hour."); $redis->del("vk_dialog:{$userId}"); } else { sendVkMessage($userId, "Cannot recognize the number. Enter in format +7XXXXXXXXXX"); } break; } 

What Metrics Can Be Tracked in the Bot?

The bot logs every action: number of dialogs, percentage of successfully qualified leads, response time, conversion from message to lead. These data can be exported via Bitrix24 REST into reports. Metrics help optimize scenarios and increase automation ROI.

Creating a Lead and Notifying the Manager

<?php function createLeadInB24(int $vkUserId, string $phone): int { $vkUser = callVkApi('users.get', ['user_ids' => $vkUserId, 'fields' => 'photo_200']); $name = $vkUser[0]['first_name'] . ' ' . $vkUser[0]['last_name']; $result = $b24->callMethod('crm.lead.add', [ 'fields' => [ 'TITLE' => "VK: {$name}", 'NAME' => $vkUser[0]['first_name'], 'LAST_NAME' => $vkUser[0]['last_name'], 'PHONE' => [['VALUE' => $phone, 'VALUE_TYPE' => 'WORK']], 'SOURCE_ID' => 'VK', 'COMMENTS' => "VKontakte ID: {$vkUserId}\nhttps://vk.com/id{$vkUserId}", 'ASSIGNED_BY_ID' => 5, ], ]); $b24->callMethod('crm.activity.add', [ 'fields' => [ 'OWNER_TYPE_ID' => 1, 'OWNER_ID' => $result['result'], 'TYPE_ID' => 4, 'SUBJECT' => 'VK Correspondence', 'DESCRIPTION' => $dialogHistory, ], ]); return $result['result']; } 
<?php $keyboard = [ 'one_time' => true, 'buttons' => [[ ['action' => ['type' => 'text', 'label' => 'Leave a request', 'payload' => '{"action":"lead"}'], 'color' => 'primary'], ['action' => ['type' => 'text', 'label' => 'Call us', 'payload' => '{"action":"call"}'], 'color' => 'secondary'], ]], ]; callVkApi('messages.send', [ 'user_id' => $userId, 'message' => 'Select an action:', 'keyboard' => json_encode($keyboard), 'random_id' => time(), ]); 
<?php $b24->callMethod('im.notify', [ 'to' => $managerId, 'message' => "New lead from VK: {$name}, tel. {$phone}. [URL=https://b24.ru/crm/lead/{$leadId}/]Open[/URL]", 'type' => 'SYSTEM', ]); 

Reliability of Custom Integration

Open Lines depend on B24 server stability and do not allow extending functionality. A custom bot runs on your server; you control uptime, logic, and security. The code is open for improvements, not locked in a black box.

Development Timeline for VK Bot

Stage Duration
Setting up VK Callback API, basic message receiving 1–2 days
Bot scenario (FSM, state storage) 2–4 days
Integration with B24: lead creation, activities 2–3 days
Buttons, menus, attachment processing 1–2 days
Manager notifications 1 day
Testing 1–2 days

Total: 1.5–2 weeks for a standard lead qualification scenario.

Comparison of Integration Methods

Criterion Open Lines Custom Bot
Logic control No Full control via FSM
Lead creation No Yes, via REST API
Buttons and menus No Yes, VK keyboards
Notifications No Yes, im.notify
Conversion Basic +30% according to our data
Customization flexibility No Full

Typical Integration Mistakes

  • Incorrect Callback API setup (secret key not specified).
  • Missing server confirmation handling (confirmation token).
  • Invalid phone number format (no validation).
  • Ignoring VK API limits (20 requests/sec).
  • Incorrect access rights for Bitrix24 REST API.

What Is Included in the Work?

  • Turnkey bot development: from Callback API setup to server deployment.
  • Bitrix24 integration: creating leads, deals, contacts; storing dialog history.
  • Scenario design: FSM, menus, lead qualification.
  • Documentation on API methods and architecture.
  • Training managers on bot usage.
  • Six-month code warranty.

We will assess your project for free — write to us, and we will offer a solution with precise timelines and cost. Get a consultation for your project — we will send a rough plan and timeline. Order VK bot development with Bitrix24 integration — the solution pays for itself within a month through automation.