Recently, an electronics e‑commerce site came to us: the chat widget wasn't showing on mobile, and leads weren't being created. Turns out, the Content Security Policy was blocking the script, and visitor identification failed because the browser removed the cookie. We fixed it in two hours.
Connecting a Bitrix24 online chat to your site isn't just copy‑pasting a code snippet. It's about configuring visitor identification, integrating with CRM, and ensuring stable, long‑term operation. The Bitrix24 online chat widget can be placed on any platform – WordPress, 1С‑Bitrix, custom SPA – as long as you can insert JavaScript. We handle the entire setup: from widget appearance to CRM integration and 54‑FZ fiscalization. Our team has over 5 years of experience and has completed 30+ chat integration projects.
How the Chat Works Technically
A visitor clicks the widget → the dialog window opens → the message goes via WebSocket to an open channel → an operator replies → the answer appears instantly on the site. Session data is stored in LocalStorage and on the Bitrix24 server. The widget requires PHP 8.1+ and MySQL 5.7+. It loads asynchronously, so it doesn't affect page load speed. According to Bitrix24's official documentation, the widget supports custom events for extended logic. For advanced configurations, you can use webhooks to trigger external actions.
Getting the Widget Code
Navigate to Bitrix24 → CRM → Contact Center → Online Chat → Create, customize the appearance, and copy the embed code. Example:
<script>
(function(w,d,u){
var s=d.createElement('script');
s.async=true;
s.src=u+'?'+(Date.now()/60000|0);
var h=d.getElementsByTagName('script')[0];
h.parentNode.insertBefore(s,h);
})(window,document,'https://yourcompany.bitrix24.ru/upload/crm/site_button/loader_X_XXXXXXXX.js');
</script>
Insert the code before </body> on every page. For WordPress, use the wp_footer hook or a plugin like Insert Headers and Footers. For 1C‑Bitrix, place it in footer.php or via an HTML block component.
Attaching the Chat to the CRM
During widget setup, specify an open channel (sales or support), enable auto‑creation of a lead on the first message, set the source to 'Site' (SOURCE_ID), and define a data‑collection form (name, phone, email). With proper configuration, lead conversion can increase by up to 30%. For returning visitors, the cookie BITRIX_SM_SALE_UID restores chat history. You can also set up business processes: when a lead is created, automatically send a notification to a manager or trigger a chain of actions via Bizproc. The entire integration process takes an average of 4 hours.
Common Technical Issues and Solutions
| Problem |
Cause and Solution |
| Widget doesn't appear |
CSP blocks the script. Add *.bitrix24.ru to script-src and connect-src. |
| Messages not sending |
Ad blocker or firewall blocks WebSocket. Configure an exception or disable the blocker for the domain. |
| Slow page load |
The script loads asynchronously – does not affect LCP. If issues persist, check for synchronous load in <head> (not recommended). |
| Chat overlaps content on mobile |
Set margin offsets in Bitrix24 – separate for mobile and desktop. |
| Returning visitors not recognized |
Ensure the BITRIX_SM_SALE_UID cookie is not deleted. Enable identification via e‑mail from the form. |
Out‑of‑the‑Box Widget vs. Custom Development
| Feature |
Ready Widget |
Custom Development |
| Setup time |
1–2 days |
1–2 weeks |
| Cost |
$500–$1,500 depending on complexity |
$3,000–$10,000 |
| Flexibility |
Color, position, form |
Any logic, integration with 1C, fiscalization |
A ready widget is set up three times faster than a custom solution. For an electronics store that came to us, we implemented a project with 30 operators, 12,000 dialogs per month, and integration with 1C UT and ATOL – response time dropped by 40%.
What's Included in Our Work
- Site audit (platform, caching, CSP).
- Widget installation on all pages with compatibility check.
- Open channel setup, auto lead creation, data collection form.
- CRM integration: link to deals, sync contacts.
- Fiscalization (54‑FZ) if required – via ATOL Online or OFD.
- Testing on mobile and desktop.
- Transfer of access and a quick user guide.
- 2‑year warranty on the installation.
Our Process
- Analysis – examine the site, CSP, stack, caching.
- Design – choose widget type, define CRM fields.
- Implementation – insert code, set up bots, integrate with 1C/OFD.
- Testing – verify WebSocket, lead creation, mobile rendering.
- Deployment – publish to production, monitor for 24 hours.
Timeframes and Cost
Setup takes from 2 hours to 3 days, depending on complexity. The cost is determined after a free audit. Our typical pricing starts at $500 for basic integration. Contact us for a project evaluation – no obligation.
Pre‑Launch Checklist
- Code placement – use
async or insert before </body>.
- CSP policy – allow
*.bitrix24.ru in script-src and connect-src.
- Identification – configure the
BITRIX_SM_SALE_UID cookie.
- Mobile devices – test on real devices.
Set up your Bitrix24 chat today – we'll evaluate your project for free in one day. Get in touch to discuss the details. An online chat is not only convenient for your visitors but also a boost to your conversion rates.
Open Lines: Where It All Begins and Breaks
The Open Lines module (imopenlines) is the standard Bitrix24 mechanism for omnichannel communications. It connects an external channel to an internal chat via the Im\Model\ChatTable entity. The problem is that out-of-the-box routing settings are primitive: "in turn" or "all at once." For a real sales department with 15+ managers, VIP clients, and SLA response times, this is not enough. We enhance routing via event handlers OnImOpenLinesChatStart and the REST API.
A manager switching between five windows loses messages, forgets to reply—the client leaves for a competitor who responded in 30 seconds. Bitrix24 messenger configuration gathers all channels into one interface, and CRM records every touch. Experience shows that after setup, average first response time drops by 40% within the first week.
How we implement messenger integration
We connect Telegram, WhatsApp, Viber, VK, online chat, email, and other channels via standard connectors or REST API. Each channel requires its own configuration, but the result is unified—all messages end up in open lines, and from there into the client card. We guarantee no message gets lost: we use tagged caching and agents to check queues.
How to connect WhatsApp to Bitrix24?
WhatsApp is the main business channel. Integration via WhatsApp Business API with a verified account. We configure sending and receiving messages from the Bitrix24 interface—they fall into an open line. We create HSM templates for initiating dialog (abandoned cart reminders, order status). Templates go through Meta moderation—allow 2-3 days. We ensure file, image, and document transfer. We link conversations to contacts and deals via CRM_ENTITY_TYPE and CRM_ENTITY_ID.
| Method |
Nuances |
Payment Model |
| WhatsApp Business API (Cloud) |
Verification via Meta Business, templates, bulk messaging |
Per conversation window (24h) |
| Provider (Edna, Wazzup, Chat2Desk) |
Quick start, intermediary service, own limits |
Subscription fee |
| Bitrix24 CRM Marketing |
Built-in integration, minimal setup |
Included in Professional+ tariff |
Telegram: Free Channel with High Reach
Telegram Bot API is free and well-documented—a pleasant rarity among messengers. Integration into Bitrix24 is done via the imopenlines connector. Setup: connect the bot to open lines, configure the connector to Telegram. Receiving messages, photos, videos, documents—all mapped to the Bitrix24 chat. Inline buttons and reply keyboards for navigation. Webhook on https://yourdomain/rest/imconnector.register—register the connector. CRM integration: incoming message creates a lead via crm.lead.add or an activity in the deal.
Telegram is indispensable for:
- Support via bot—standard questions resolved without an operator (up to 70% of inquiries).
- Notifications: orders, delivery, payment—via Telegram Bot API sendMessage.
- Lead collection: bot asks qualifying questions → creates a lead.
Viber and VK: Audience 35+ and Social Network
Viber maintains positions in regions. We connect a business account via the open lines connector. We use Viber Business Messages—bulk messaging with action buttons and rich content. Receiving and sending from CRM works immediately.
VK (Vkontakte) is the largest social network in Russia. Integration via the imopenlines community messages connector. Process messages and comments from a single interface. Auto-creation of a lead—handler OnImOpenLinesCrmCreate. Integration with VK Ads for tracking sources via UTM. Bot for auto-replies—VK Bot API + Callback API.
Why is proper routing of inquiries important?
Distribution of inquiries among operators is organized through queue mechanisms. By default: "who is free." In reality, more complexity is needed:
- Determining responsible person by number or email from CRM—
im.chat.get + search via crm.contact.list.
- Distribution by departments based on keywords (NLP classifier or simple regex on first message).
- Priority queue for VIP—by segment in CRM.
- Escalation on 5-minute timeout—auto-switch to next.
- Transition to call directly from chat—
telephony.externalcall.register.
We use custom event handlers OnImOpenLinesChatStart and REST API to implement such scenarios. Additionally, we connect Bizproc for complex approval chains and integration with HL blocks for storing custom queue parameters. Result: client does not wait, operator is not overloaded.
What is included in messenger integration work
| Component |
Description |
| Audit of current CRM structure |
Analysis of inquiry types, channels, operator load |
| Connecting channels |
Configuration of WhatsApp, Telegram, Viber, VK, email, online chat connectors |
| Routing setup |
Queues, distribution by competence, escalations, SLA |
| Chatbot development |
Script-based or with NLP, integration with CRM and external APIs |
| Operator training |
Documentation, video instruction recording, webinar |
| Testing and support |
Running all scenarios, 2-week monitoring after launch |
| 6-month warranty |
Free bug fixes, consultations |
Chatbots: Script-Based and with NLP
Types
Script-based (rule-based): button menu, decision tree. "How to pay" → "Where is my order" → "Business hours." Transfer to operator at intent == 'unknown' → transfer_to_queue. Reliable, predictable, covers 60-70% of typical inquiries.
With NLP: free text in Russian. Intent detection (buy, complain, inquire about delivery), entity extraction (name, date, order number). Contextual dialog—remembers what was discussed. Implemented on Rasa or Dialogflow, integrated with Bitrix24 via REST.
Example handler code for a script-based bot (PHP)
use Bitrix\Main\Loader;
use Bitrix\Imopenlines\Model\SessionTable;
Loader::includeModule('imopenlines');
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler('imopenlines', 'OnImOpenLinesMessageReceive', function($event) {
$message = $event->getParameter('message');
$chatId = $event->getParameter('chatId');
if (preg_match('/order status (\d+)/i', $message, $matches)) {
$orderId = $matches[1];
// Get order status via API
$order = \Bitrix\Sale\Order::load($orderId);
if ($order) {
$status = $order->getField('STATUS_ID');
\Bitrix\ImOpenLines\Chat::sendMessage($chatId, 'Your order #' . $orderId . ' status: ' . $status);
}
}
});
Scenarios and Real Impact
| Scenario |
Action |
Operator Relief |
| FAQ |
Answers from knowledge base based on intent match |
30-50% |
| Order status |
Request sale.order.get by number |
15-25% |
| Booking |
Date/specialist selection, creation via API |
20-30% |
| Calculation |
Preliminary estimate based on parameters |
10-20% |
| Lead qualification |
Data collection → crm.lead.add |
3x funnel acceleration |
| NPS/CSAT |
Rating after service |
100% automatic collection |
Comparison: a script-based bot processes requests 5 times faster than an operator, and an NLP bot reduces fallback rate to 15% after training on real dialogs. Average savings on operator salary when implementing a chatbot amount to substantial monthly savings.
How can chatbots transform your customer support?
Development Process
- Inquiry analysis—export history from open lines, cluster by topic. Identify 80% of typical requests.
- Dialog design—map on miro/figma. Each branch ends either with an answer or transfer to operator.
- Development—logic, integration with CRM and external APIs. For script-based: finite state machine. For NLP: pipeline: tokenizer → featurizer → classifier → response selector.
- NLP training—on real dialogs (at least 500 examples). Set confidence threshold.
- Testing—run all branches, edge cases (empty message, sticker, voice).
- Optimization—monitor fallback rate, retrain on new dialogs every 2 weeks.
Timeline
| Task |
Duration |
| Single messenger connection |
1-2 days |
| Open lines setup |
2-3 days |
| Script-based bot (basic) |
1-2 weeks |
| Bot with NLP |
3-6 weeks |
| Comprehensive omnichannel system |
4-8 weeks |
Result: all communications in one window, routine automated, no message lost. Managers sell, not search for the right chat. Evaluate which channels you need—contact us, we'll select for your niche. Get a personalized timeline and cost estimate for your project.