Skip to main content

A8Chat Web Widget

Chat Bot Script

Embed the below script into your website to acquire the chat widget. Include the chat bot script dependency jquery library in your site head tag.

<script src="https://code.jquery.com/jquery-3.4.1.min.js"> </script>

Widget Script

<script>
if (!sessionStorage.userId) {
sessionStorage.userId = new Date().getTime();
}
window.a8bot = {
appConfig: {
isFloatingIcon: true,
showAfterInterval: "icon",
/*"icon" || "chat" || "notify"*/
notifyText: "",
initTime: 1000,
/*ms*/
sessionDuration: "1 day"
/*"1 year" || "2 months" || "4 days" || "6 hours" || "8 minutes"*/
},
cusInfo: {
appKey: "<AppKey>",
displayName: "<UserName>",
orgId: "<OrgID>",
botHandle: "<BotHandle>",
userId: "<UserID>",
email: "<EmailID>"
}
};

var script = document.createElement("script");
script.type = "text/javascript";
script.id = "a8_chat_widget";
script.src = "<HostedURL>";

document.body.appendChild(script);
</script>

In the above script, replace the following fields

  • AppKey
  • UserName
  • OrgID
  • BotHandle
  • UserID
  • EmailID
  • HostedURL

isFloatingIcon

✅ This to decide whether the chat icon should be dragable or not. if true you can drag, if false can't drag.

showAfterInterval

✅ This to decide what we want on chat initiate. It has the following options.

icon

✅ Chat icon will be loaded without notification.

chat

✅ Chat widget will be open directly.

notify

✅ If notify has given, chat icon will be loaded with notification. We can add a text in "notifyText". That text will be displayed in the notification bubble.

initTime

✅ The duration to load chat icon after the site was opened.

sessionDuration

✅ This is to decide that how long the chat conversation should be there in the widget. Default session duration is 15 minutes. We can change the session duration as per client requirement. This is the format of session duration: "1 year" or "2 months" or "4 days" or "6 hours" or "8 minutes".

appKey

✅ Corresponding bot's app key.

displayName

✅ The user name to be displayed in the chat.

orgId

✅ Corresponding bot's organisation id.

botHandle

✅ Corresponding bot's bot handle name.

userId

For User ID of the particular client's users, we can use either (sessionStorage.us erId) or (localStorage.userId). If the same chat opened in multiple tabs of a single browser, localStorage.userId local will create same chat session in all the tabs and sessionStorage.userId will create unique chat session of the particular chat in each tab of same browser.

This is possible only in case when that user Id provided by us.