57 lines
2.4 KiB
JavaScript
Executable File
57 lines
2.4 KiB
JavaScript
Executable File
(function() {
|
|
var botmanCDN = document.createElement("script");
|
|
botmanCDN.src = "https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/widget.js";
|
|
botmanCDN.defer = true;
|
|
document.head.appendChild(botmanCDN);
|
|
|
|
botmanCDN.onload = function() {
|
|
var botmanWidget = {
|
|
// chatServer: 'https://appstage.nhanceindia.in/arena/crm/chat',
|
|
// frameEndpoint: 'https://appstage.nhanceindia.in/arena/crm/widget',
|
|
// chatServer: 'https://app.nhanceindia.in/zenith/chat ',
|
|
//frameEndpoint: 'https://app.nhanceindia.in/zenith/widget',
|
|
chatServer: 'https://venbait.in/nhance/dev/chat',
|
|
frameEndpoint: 'https://venbait.in/nhance/dev/widget',
|
|
title: "Ask ILA",
|
|
introMessage: "",
|
|
bubbleBackground: "#007bff",
|
|
mainColor: "#007bff",
|
|
placeholderText: "Type your message here...",
|
|
aboutText: "Insurance Assistant ILA",
|
|
enableAttachments: false,
|
|
parameters: {
|
|
employee_id: localStorage.getItem('empPrimaryId') || '',
|
|
session_id: generateSessionId(15),
|
|
origin: "mobile",
|
|
emp_code: localStorage.getItem('empCode') || '',
|
|
client_id: localStorage.getItem('client_id') || '',
|
|
client_branch_id: localStorage.getItem('empClientBranchId') || ''
|
|
}
|
|
};
|
|
|
|
function generateSessionId(length = 15) {
|
|
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
let sessionId = '';
|
|
for (let i = 0; i < length; i++) {
|
|
sessionId += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
}
|
|
return sessionId;
|
|
}
|
|
|
|
function openBotmanChat() {
|
|
var checkBotman = setInterval(function () {
|
|
if (typeof botmanChatWidget !== "undefined" && botmanChatWidget.open) {
|
|
clearInterval(checkBotman);
|
|
botmanChatWidget.open();
|
|
setTimeout(function () {
|
|
botmanChatWidget.sayAsBot('Hi ' + (localStorage.getItem('gpaEmpName') || '') +
|
|
', This is ILA, your Insurance Assistant. Please choose an option.');
|
|
}, 2000);
|
|
}
|
|
}, 500);
|
|
}
|
|
|
|
window.openBotmanChat = openBotmanChat;
|
|
};
|
|
})();
|