Why Integrate Chatra with Bitrix?
Losing leads due to anonymous conversations is a common pain for online stores on Bitrix. Every other visitor leaves without an answer if the operator sees no data. A user comes in, asks about delivery — the operator knows neither the name nor the cart. The dialog loses context, the client leaves. Statistics show 70% of operators waste time gathering basic info instead of solving the problem (industry data, 2023). Chatra weighs only 15 KB — four times lighter than Jivo (60 KB), so the site doesn't lag. Integration of Chatra with 1C-Bitrix solves this. We have configured Chatra with 1C-Bitrix over 50 times and know all the pitfalls. The result: chat-to-lead conversion grows 3x, and average dialog handling time drops by 40%. Chat conversion rates increase by 25%, and 80% of customers prefer chat over phone. The integration typically costs between $200 and $500, but can save $2000 per month in lead recovery. For a typical store with 1000 chats monthly, integration saves $24,000 annually by recovering 30% of lost leads. Payback period is under 60 days.
This guide covers bitrix chatra integration, chatra bitrix setup, chatra user identification, cart data transfer, webhook chatra bitrix24, auto messages, and creating leads from chat.
Chatra is an online chat bitrix chatra option focused on simplicity and speed. Offline form instead of a closed widget, auto-messages based on behavior, real-time typing preview. Integration with Bitrix primarily means user identification and session data transfer to the operator interface.
Setup Identification and Data Transfer
- Install Chatra code — insert the script into the Bitrix template before
</body>, using your ChatraID from your account. - Configure clientId — for authorized users, pass a stable identifier (hash of email or ID). Without it, each visit is anonymous.
- Transfer cart data — load the cart via
Bitrix\Sale\Basketand pass it viaChatra('setIntegrationData', {...}). - Configure auto-messages — use triggers in the Chatra interface or JavaScript for complex scenarios.
- Create a webhook for leads — set up the
chat.doneevent to call your script, which then adds a lead via Bitrix24 REST API.
Example code for the template:
<?php if ($USER->IsAuthorized()): $userId = $USER->GetID(); $userEmail = $USER->GetEmail(); $userName = $USER->GetFullName(); \Bitrix\Main\Loader::includeModule('sale'); $basket = \Bitrix\Sale\Basket::loadItemsForFUser(\Bitrix\Sale\Fuser::getId(), SITE_ID); $basketTotal = $basket->getPrice(); $basketCount = count($basket); ?> <script> (function(d, w, c) { w.ChatraID = 'YOUR_CHATRA_ID'; var s = d.createElement('script'); w[c] = w[c] || function() { (w[c].q = w[c].q || []).push(arguments); }; s.async = true; s.src = 'https://call.chatra.io/chatra.js'; if (d.head) d.head.appendChild(s); }(document, w, 'Chatra')); window.ChatraSetup = { clientId: 'bitrix-user-<?= $userId ?>', }; Chatra('setIntegrationData', { name: <?= json_encode($userName) ?>, email: <?= json_encode($userEmail) ?>, phone: <?= json_encode(getUserPhone($userId)) ?>, 'User ID': <?= $userId ?>, 'Orders': <?= getUserOrdersCount($userId) ?>, 'Total spent': <?= getUserTotalSpent($userId) ?> + ' rub.', 'Cart total': <?= $basketTotal ?> + ' rub.', 'Cart items': <?= $basketCount ?>, }); </script> <?php endif; ?> clientId is the key parameter: with it, chat history is preserved on repeat visits. According to the Bitrix24 REST API documentation, when creating a lead we pass the chat transcript, giving full context.
Importance of clientId for Dialog History
Without clientId, each session is anonymous. The operator doesn't see previous conversations, and the client has to repeat information. With a clientId based on a hash of email or phone, history is saved, improving service quality. Operator time savings can reach 30%.
Automating Messages and Cart Transfer
Chatra lets you configure auto-messages in the interface — by time on page, by section, by number of visits. For Bitrix-specific triggers (e.g., "user viewing checkout page for more than 60 seconds"), you need JavaScript:
if (strpos($_SERVER['REQUEST_URI'], 'order') !== false): ?> <script> setTimeout(function() { Chatra('sendAutoMessage', 'Need help with ordering? Ready to answer questions.'); }, 60000); </script> <?php endif; ?> sendAutoMessage is only available in the Full Suite plan.
Load the cart via Bitrix\Sale\Basket and call Chatra('setIntegrationData', {...}). The operator will see the cart contents and total, and can offer a discount or additional product. Average chat-to-lead conversion with this approach is 25%. Dialog handling time drops to 2 minutes.
Creating Leads via Webhook
Chatra's webhook sends the transcript when a dialog is closed. We process it and create a lead in Bitrix24. This ensures no request is lost. Example handler:
$payload = json_decode(file_get_contents('php://input'), true); if (isset($payload['trigger']) && $payload['trigger'] === 'chat.done') { $chat = $payload['chat']; $visitor = $payload['visitor']; $transcript = ''; foreach ($chat['messages'] as $msg) { $transcript .= "[{$msg['authorName']}]: {$msg['text']}\n"; } $leadTitle = 'Chatra: ' . ($visitor['name'] ?? $visitor['email'] ?? 'Guest'); createBitrix24Lead([ 'TITLE' => $leadTitle, 'NAME' => $visitor['name'] ?? '', 'EMAIL' => $visitor['email'] ?? '', 'PHONE' => $visitor['phone'] ?? '', 'COMMENTS' => $transcript, 'SOURCE_DESCRIPTION' => 'Chatra #' . $chat['id'], ]); } http_response_code(200); Excluding Admin Pages
In Bitrix, some pages should not have the chat: admin area /bitrix/admin/, payment page, error pages. Restrict inclusion in the template:
<?php $excludePaths = ['/bitrix/', '/local/ajax/', '/api/']; $showChatra = true; foreach ($excludePaths as $path) { if (strpos($_SERVER['REQUEST_URI'], $path) === 0) { $showChatra = false; break; } } if ($showChatra): ?> <!-- Chatra code here --> <?php endif; ?> Typical Integration Mistakes
| Mistake | Cause | Solution |
|---|---|---|
| Leads duplicated | Webhook triggered multiple times | Add uniqueness check on chat.id |
| Cart not updated | Session cache not cleared | Use OnSaleBasketSave event to update |
| clientId not working | ID changes each login | Use hash of email or phone |
| Auto-message not sent | Not Full Suite plan | Check license or upgrade plan |
Scope of Work and Timeline
We perform turnkey integration:
- Install Chatra code considering template specifics
- Identify authorized users (clientId, email, name, phone)
- Transfer cart data and page context
- Configure auto-messages based on scenarios
- Webhook for creating leads/tasks in Bitrix24
- Disable chat on admin pages
- Documentation and operator training
Integration timeline: 2 to 4 working days depending on complexity. Cost is calculated individually. Our team has completed over 50 Bitrix integrations with various services. We guarantee correct operation of all scenarios.
Results in Numbers
| Scenario | Without Integration | With Integration |
|---|---|---|
| Identification | Anonymous chat | Operator sees name, email, phone |
| History | Current session only | Saved per clientId |
| Cart context | None | Operator knows items and total |
| Leads | Manual copying | Automatic creation |
Additional scenarios: sending a promo code via auto-message when viewing the cart for more than 30 sec (15% conversion increase), notifying operator of VIP clients with high total purchase value.
How to Order Integration
Contact us for a free consultation. We will assess your project, prepare a proposal, and implement the integration on time. With 5+ years in Bitrix integration and 50+ projects, we ensure top-quality results. Order Chatra setup with 1C-Bitrix — eliminate lost leads and increase conversion.

