Developing an AI bot for 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.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1173
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • 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
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    745
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

Development of AI Bot for Bitrix24

Bitrix24 has a built-in Copilot — an AI assistant from Bitrix. But Copilot is a closed tool with fixed scenarios. If you need a bot to answer customer questions from your company's knowledge base, automatically create tasks from messages, score leads, or respond on behalf of managers in open channels — you need custom development.

AI Bot Architecture

An AI bot in Bitrix24 is an application registered through REST API. It receives incoming messages via webhooks, processes them (using an LLM or its own logic), and responds through API.

Diagram:

User → Bitrix24 Chat → Webhook → Bot Server → LLM API (OpenAI, Yandex GPT...) → Response → Bitrix24 API → Chat

Bot Registration is done via imbot.register method:

imbot.register
  NAME = "Sales Assistant"
  CODE = "sales_bot"
  TYPE = "H" (Human-like) or "B" (Bot)
  EVENT_MESSAGE_ADD = https://your-server.com/bot/message
  EVENT_WELCOME_MESSAGE = https://your-server.com/bot/welcome
  EVENT_BOT_DELETE = https://your-server.com/bot/delete

The bot appears in the user list and in open channels.

Where the Bot Works

The bot can function in several contexts:

Context API Application
Bitrix24 Chats im.message.add, imbot.message.add Internal assistant for employees
Open Channels imopenlines.* Answers to customers in website chat, VK, Telegram
CRM (smart processes, robots) bizproc.*, crm.activity.* Pipeline automation
Voice Input Via Copilot API Call transcription

Open channels are the most popular context: the bot answers customers and transfers conversation to a live manager by set triggers.

Integration with LLM

Most AI bots are built on OpenAI GPT-4 or GPT-4o, Yandex GPT, or local models (LLaMA via Ollama). Interaction scheme:

  1. Bot receives message from user via webhook.
  2. Forms a prompt: system instructions (role, constraints, response style) + dialogue history (context window) + current question.
  3. Sends request to LLM API.
  4. Gets response, formats if needed.
  5. Sends response to Bitrix24 chat via imbot.message.add.

Context Management. LLM doesn't store history between requests — that's the bot server's job. Dialogue history is stored in a database (Redis, PostgreSQL) with the chat_id key from Bitrix24. Each message retrieves history, adds new message, truncates to maximum context window.

RAG: Answering from Company Knowledge Base

To make the bot answer questions from company documents, products, regulations — use RAG (Retrieval-Augmented Generation):

  1. Indexing: knowledge base documents are split into fragments, each gets a vector representation (embedding). Stored in a vector DB (Pinecone, Qdrant, pgvector).
  2. Search: on user question, its embedding is created, nearest fragments are found in vector DB.
  3. Generation: found fragments are added to prompt as context. LLM answers based on real company data.

This eliminates LLM "hallucinations" — the bot doesn't invent answers but references uploaded materials.

Handing Off to Manager

When the bot can't answer or the customer explicitly wants a live operator — the call transfers to a manager. In open channels this is done via imopenlines.session.transfer. The bot sends "Connecting you with a manager" and calls the transfer method.

Transfer conditions:

  • Keywords in message ("call me", "manager", "urgent").
  • Iteration count: if bot doesn't resolve the issue in 3 messages — escalate.
  • Wait time: if no response in 5 minutes — create a manager task.

Bot Actions in CRM

Besides chat responses, the bot can perform CRM actions:

  • Create lead: crm.lead.add with data from dialogue.
  • Fill deal fields based on conversation analysis.
  • Create task: tasks.task.add — "Call customer at 3 PM".
  • Send proposal: generate PDF via crm.quote.* and send via crm.activity.add.

For this, the bot server calls Bitrix24 REST API on behalf of a user (OAuth 2.0 or webhook).

Development Timeline

Option Scope Timeline
Basic FAQ answers, handoff to manager 5–7 days
With embedded knowledge base (RAG) Document indexing, knowledge base search 8–12 days
Full-featured RAG + CRM actions + dialogue analytics 14–20 days