1C-Bitrix Integration with LiveTex
LiveTex is a customer communication platform: live chat, chatbots, messenger integration (WhatsApp, Telegram, VK), and handling of all conversations in a unified operator interface. Integration with Bitrix solves two problems: enriching the operator interface with client data, and passing conversations to CRM.
Installing the Widget
LiveTex provides a widget script that is connected to the Bitrix template:
<!-- In the site template, before </body> -->
<script>
(function(d, w, c) {
w[c] = w[c] || [];
w[c].push(function() {
LiveTex.Widget.init({widgetId: 'YOUR_WIDGET_ID'});
});
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://cs.livetex.ru/js/widget.js';
var f = d.getElementsByTagName('script')[0];
f.parentNode.insertBefore(s, f);
}(document, window, 'livetex_callbacks'));
</script>
In Bitrix it is more convenient to add this via Settings → Product Settings → JS Snippets — so the script is not lost when the template is updated.
Passing User Data from Bitrix
The LiveTex API allows passing name, email, phone, and arbitrary attributes before a chat begins:
<?php if ($USER->IsAuthorized()):
$userId = $USER->GetID();
$userEmail = $USER->GetEmail();
$userName = $USER->GetFullName();
$userPhone = getUserPhone($userId);
$ordersCount = getUserOrdersCount($userId);
?>
<script>
// Wait for widget initialization
(window.livetex_callbacks = window.livetex_callbacks || []).push(function () {
LiveTex.Widget.setVisitorAttributes({
name: <?= json_encode($userName) ?>,
email: <?= json_encode($userEmail) ?>,
phone: <?= json_encode($userPhone) ?>,
custom: {
'User ID': <?= $userId ?>,
'Total orders': <?= $ordersCount ?>,
'Total spent': <?= getUserTotalSpent($userId) ?>,
}
});
});
</script>
<?php endif; ?>
The operator sees this data in the conversation card to the left of the chat. custom is a dictionary of arbitrary data displayed in the LiveTex interface.
Passing Page URL and Context
LiveTex automatically detects the page URL, but you can pass additional context — such as the section name or product ID on a product page:
<?php if (defined('CURRENT_PRODUCT_ID')): ?>
<script>
(window.livetex_callbacks = window.livetex_callbacks || []).push(function () {
LiveTex.Widget.setVisitorAttributes({
custom: {
'Current product': <?= json_encode($arResult['NAME']) ?>,
'SKU': <?= json_encode($arResult['PROPERTIES']['ARTICLE']['VALUE']) ?>,
'Price': <?= $arResult['CATALOG_PRICE_1'] ?> + ' USD',
}
});
});
</script>
<?php endif; ?>
LiveTex Webhook for Creating Conversations in Bitrix
LiveTex sends a webhook when a dialog closes. This is used to create leads or tasks in Bitrix24:
// /local/api/livetex-webhook.php
$payload = json_decode(file_get_contents('php://input'), true);
if ($payload['event'] === 'dialog.closed') {
$dialog = $payload['data']['dialog'];
$visitor = $dialog['visitor'];
$messages = $dialog['messages'];
// Compile chat transcript
$transcript = implode("\n", array_map(function($msg) {
return "[{$msg['author']['name']}]: {$msg['text']}";
}, $messages));
// Create a lead in Bitrix24
createBitrix24Lead([
'TITLE' => 'LiveTex: ' . ($visitor['name'] ?? 'Visitor'),
'NAME' => $visitor['name'] ?? '',
'EMAIL' => $visitor['email'] ?? '',
'PHONE' => $visitor['phone'] ?? '',
'COMMENTS' => $transcript,
'SOURCE_ID' => 'WEB',
'SOURCE_DESCRIPTION' => 'LiveTex, dialog #' . $dialog['id'],
]);
}
http_response_code(200);
echo 'ok';
The webhook URL is set in the LiveTex admin panel: Settings → Integrations → Webhooks.
Integration with Bitrix24 via Open Lines
If the client has Bitrix24 (not just 1C-Bitrix), LiveTex can function as an external channel via the Open Lines API. Messages from LiveTex appear in Bitrix24 CRM as Open Line conversations; the operator responds from Bitrix24, and the reply goes back to the client in the on-site chat.
This requires configuring the Bitrix24 REST API and registering webhooks in both directions — more complex than simple lead creation, but it gives the operator a single interface without switching between systems.
Scope of Work
- Installing the LiveTex widget in the Bitrix template
- Script for passing authenticated user data
- Passing page context (catalog section, product page)
- Webhook configuration for lead creation in Bitrix24
- Testing across different scenarios (guest, authenticated, mobile browser)
Timelines: installation and basic data passing — 1–2 days. Webhook and lead creation — another 1–2 days. Full integration with Bitrix24 Open Lines — 1–2 weeks.







