1C-Bitrix Integration with JivoSite
JivoSite is one of the most widely used live chat solutions on the market. A basic installation takes 5 minutes: insert the widget script and you're done. But there is a level of integration that makes the chat genuinely valuable for your business: passing user data from Bitrix into the Jivo agent window, and synchronizing contacts and conversations with CRM.
Integration Levels
Level 1 — Basic. Installing the JivoSite script on all site pages. In Bitrix this is done via the admin interface: Settings → Product Settings → JS Snippets, or through the bitrix:main.include component in the site template.
<!-- In the site template, before </body> -->
<script src="//code.jivosite.com/widget/{JIVO_ID}" async></script>
Level 2 — User data passing. When a visitor is logged in on the Bitrix site, we pass their name, email, and phone to Jivo — the agent immediately sees who they are talking to.
Level 3 — Events and custom data. We pass context: the current page, cart items, order history — the agent sees the client's behavior without needing to ask.
Level 4 — Bitrix24 CRM integration. Conversations from Jivo automatically create leads or contacts in Bitrix24 CRM.
Passing Authenticated User Data
JivoSite provides a JavaScript API for passing contact information:
// In the Bitrix template, after user authentication
// Data is taken from PHP and passed to JS via data attributes or variables
<?php if ($USER->IsAuthorized()): ?>
<script>
jivo_api.setContactInfo({
name: "<?= htmlspecialchars($USER->GetFullName()) ?>",
email: "<?= htmlspecialchars($USER->GetEmail()) ?>",
phone: "<?= htmlspecialchars(getUserPhone($USER->GetID())) ?>",
description: "ID: <?= $USER->GetID() ?>, orders: <?= getUserOrdersCount($USER->GetID()) ?>"
});
</script>
<?php endif; ?>
getUserPhone() and getUserOrdersCount() are your helper functions that query b_user_field (or b_sale_order) to retrieve the needed data. Do not run heavy queries directly in the template — cache the result in the session or use CPHPCache.
Passing Cart and Order Data
Jivo allows passing arbitrary user data via jivo_api.setCustomData():
<?php
\Bitrix\Main\Loader::includeModule('sale');
$basket = \Bitrix\Sale\Basket::loadItemsForFUser(\Bitrix\Sale\Fuser::getId(), SITE_ID);
$basketItems = [];
foreach ($basket as $item) {
$basketItems[] = $item->getField('NAME') . ' × ' . (int)$item->getField('QUANTITY');
}
?>
<script>
jivo_api.setCustomData([
{
title: "Cart",
content: "<?= htmlspecialchars(implode(', ', $basketItems) ?: 'empty') ?>"
},
{
title: "Last Order",
content: "<?= htmlspecialchars(getLastOrderInfo($USER->GetID())) ?>"
}
]);
</script>
This appears in the Jivo agent's side panel — to the right of the chat — without needing to ask the client.
Bitrix24 CRM Integration via Jivo Webhook
JivoSite can send a webhook when a conversation ends. The goal: automatically create a lead or contact in Bitrix24.
In Jivo settings: Channels → Configure → Webhooks → Chat close URL.
Handler in Bitrix24 (via REST API):
// /local/api/jivo-webhook.php
$data = json_decode(file_get_contents('php://input'), true);
$visitorName = $data['visitor']['name'] ?? 'Visitor';
$visitorEmail = $data['visitor']['email'] ?? '';
$visitorPhone = $data['visitor']['phone'] ?? '';
$chatId = $data['id'] ?? '';
$chatUrl = $data['chat_url'] ?? '';
// Create a lead in Bitrix24 via REST
$bitrix24Url = 'https://your-domain.bitrix24.ru/rest/{USER_ID}/{API_KEY}/';
$leadData = [
'fields' => [
'TITLE' => 'JivoSite Chat: ' . $visitorName,
'NAME' => $visitorName,
'EMAIL' => [['VALUE' => $visitorEmail, 'VALUE_TYPE' => 'WORK']],
'PHONE' => [['VALUE' => $visitorPhone, 'VALUE_TYPE' => 'WORK']],
'COMMENTS' => 'Source: JivoSite. Chat: ' . $chatUrl,
'SOURCE_ID' => 'OTHER',
'SOURCE_DESCRIPTION' => 'JivoSite Chat #' . $chatId,
],
];
$ch = curl_init($bitrix24Url . 'crm.lead.add.json');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($leadData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
http_response_code(200);
echo json_encode(['status' => 'ok', 'lead_id' => $result['result'] ?? null]);
Syncing Email and Phone with the Bitrix Profile
If a client leaves contact details in chat, they can be written to the Bitrix user profile on their next login. To do this, Jivo passes the data via webhook, and you save it in the session or a temporary table keyed by the Jivo session cookie identifier (visitor_uid).
Case Study: Online Store with 200+ Chats per Day
An electronics store. Agents spent 2–3 minutes of every chat clarifying information: "What is your order number? What is your name?" After integration — the agent opens a chat and immediately sees the client's name, their last 3 orders with amounts, the current cart, and city by IP geolocation.
| Metric | Before | After |
|---|---|---|
| Average chat duration | 8 min | 5.5 min |
| Repeat contacts on the same issue | 18% | 9% |
| Chat-to-order conversion | 12% | 17% |
Scope of Work
- Installing the widget in the Bitrix template
- Script to pass authenticated user data to
jivo_api - Passing cart data and order history
- Webhook configuration for lead creation in Bitrix24 CRM
- Testing across all scenarios (guest, authenticated, with orders, without)
Timelines: basic installation — 1–2 hours. Passing user and cart data — 1–2 days. Webhook with Bitrix24 CRM — another 1–2 days.







