1C-Bitrix Integration with Talk-Me
Talk-Me is a multichannel platform: live chat, callback widget, and messenger aggregator (WhatsApp, Telegram, Viber) within a single operator interface. Integration with 1C-Bitrix covers the standard user data transfer block and the Talk-Me-specific channel routing mechanism.
Installing the Talk-Me Widget
<!-- In the Bitrix template, before </body> -->
<script>
(function(w,d,u,i){
w.TalkMe=w.TalkMe||function(){(w.TalkMe.q=w.TalkMe.q||[]).push(arguments)};
i=d.createElement('script');i.async=true;i.src=u+'?'+parseInt(Date.now()/60000);
d.head.appendChild(i);
})(window,document,'https://cdn.talk-me.ru/js/talk-me.js');
TalkMe('init', {projectId: 'YOUR_PROJECT_ID'});
</script>
User Identification from Bitrix
<?php if ($USER->IsAuthorized()):
$userId = $USER->GetID();
$userEmail = $USER->GetEmail();
$userName = $USER->GetFullName();
?>
<script>
TalkMe('identify', {
userId: 'bx-<?= $userId ?>',
name: <?= json_encode($userName) ?>,
email: <?= json_encode($userEmail) ?>,
phone: <?= json_encode(getUserPhone($userId)) ?>,
tags: ['bitrix-user', <?= getUserOrdersCount($userId) > 0 ? "'customer'" : "'prospect'" ?>],
custom: {
orders_count: <?= getUserOrdersCount($userId) ?>,
total_spent: <?= getUserTotalSpent($userId) ?>,
loyalty: <?= json_encode(getUserLoyaltyLevel($userId)) ?>,
},
});
</script>
<?php endif; ?>
tags is a useful Talk-Me feature: operators immediately see tags on the contact card and can filter the request queue by tag. The customer and prospect tags allow routing inquiries to the appropriate operator groups.
Configuring Request Routing
Talk-Me supports routing: different pages of the site map to different operator groups. This is implemented via initialization parameters:
// On the catalog page — route to the sales team operators
TalkMe('setGroup', 'sales');
// On the support or order tracking page — route to support
TalkMe('setGroup', 'support');
Groups are configured in the Talk-Me admin panel. In Bitrix, determine the group based on the current URL or page type:
<?php
$group = 'general';
if (strpos($_SERVER['REQUEST_URI'], '/catalog/') !== false) $group = 'sales';
if (strpos($_SERVER['REQUEST_URI'], '/order/') !== false) $group = 'support';
?>
<script>
TalkMe('setGroup', <?= json_encode($group) ?>);
</script>
Callback Widget: Telephony Integration
Talk-Me includes a built-in callback widget. When using it alongside the live chat, it is important to avoid conflicts with other callback widgets that may already be installed on 1C-Bitrix. Disable any duplicate widgets: if Talk-Me is the primary communication tool, remove all standalone callback widgets.
Talk-Me Webhook for CRM
// /local/api/talkme-webhook.php
$payload = json_decode(file_get_contents('php://input'), true);
$sig = $_SERVER['HTTP_X_TALKME_SIGNATURE'] ?? '';
// Signature verification
if (hash_hmac('sha256', file_get_contents('php://input'), 'YOUR_WEBHOOK_SECRET') !== $sig) {
http_response_code(403);
exit('Invalid signature');
}
$eventType = $payload['event'] ?? '';
if ($eventType === 'chat.closed') {
$visitor = $payload['visitor'];
$messages = $payload['messages'];
$transcript = implode("\n", array_map(fn($m) => "[{$m['from']}]: {$m['text']}", $messages));
createBitrix24Lead([
'TITLE' => 'Talk-Me: ' . ($visitor['name'] ?? $visitor['phone'] ?? 'Guest'),
'NAME' => $visitor['name'] ?? '',
'EMAIL' => $visitor['email'] ?? '',
'PHONE' => $visitor['phone'] ?? '',
'COMMENTS' => $transcript,
'SOURCE_DESCRIPTION' => 'Talk-Me, channel: ' . ($payload['channel'] ?? 'chat'),
]);
}
http_response_code(200);
echo 'ok';
Talk-Me includes a channel field in the payload, enabling you to distinguish between conversations from the website chat, WhatsApp, and Telegram, and create leads with different source labels.
Sending Events from Bitrix to Talk-Me
For personalized automated messages, Talk-Me requires information about user behavior:
// After adding a product to the cart
TalkMe('event', 'add_to_cart', {
product_name: productName,
price: price,
quantity: quantity,
});
// After placing an order
TalkMe('event', 'order_placed', {
order_id: orderId,
total_price: totalPrice,
});
Based on these events, Talk-Me triggers automated messages — for example, 5 minutes after add_to_cart without a subsequent order_placed, the operator receives a notification or the system sends an automated message to the customer.
Scope of work: widget installation, user identification, routing — 1–2 days. Webhook and CRM integration — an additional 1–2 days. Trigger event configuration — 1 day.







