Интеграция онлайн-чата (LiveChat) на сайт
LiveChat — профессиональная платформа поддержки клиентов с развитым функционалом для операторов: очереди, теги, заметки, интеграции с CRM. Популярен у среднего и крупного бизнеса.
Установка виджета
<script>
window.__lc = window.__lc || {};
window.__lc.license = YOUR_LICENSE_NUMBER;
;(function(n,t,c){function i(n){return e._h?e._h.apply(null,n):e._q.push(n)}
var e={_q:[],_h:null,_v:"2.0",on:function(){i(["on",c.call(arguments)])},
once:function(){i(["once",c.call(arguments)])},
off:function(){i(["off",c.call(arguments)])},
get:function(){if(!e._h)throw new Error("[LiveChatWidget] You can't use getters before load.");
return i(["get",c.call(arguments)])},call:function(){i(["call",c.call(arguments)])},
init:function(){var n=t.createElement("script");
n.async=!0,n.type="text/javascript",
n.src="https://cdn.livechatinc.com/tracking.js",t.head.appendChild(n)}};
!n.__lc.asyncInit&&e.init(),n.LiveChatWidget=n.LiveChatWidget||e}(window,document,[].slice))
</script>
JavaScript API
// Идентификация
LiveChatWidget.call('set_customer_name', user.name);
LiveChatWidget.call('set_customer_email', user.email);
// Кастомные данные (видны оператору)
LiveChatWidget.call('set_session_variables', {
'Order ID': orderId,
'Cart Total': cartTotal + ' ₽',
'User Plan': user.plan
});
// Скрыть/показать
LiveChatWidget.call('hide');
LiveChatWidget.call('minimize');
REST API v3
// Создать тикет через REST API
Http::withBasicAuth('[email protected]', $personalAccessToken)
->post('https://api.livechatinc.com/v3.5/cases', [
'subject' => "Обращение с сайта",
'customer' => ['email' => $email, 'name' => $name],
'properties' => [
'source' => ['type' => 'email', 'url' => 'https://shop.ru/contact']
]
]);
Webhooks
LiveChat поддерживает webhooks на события: новый чат начат, чат закрыт, новое сообщение — для логирования или передачи в CRM.
Срок установки: несколько часов.







