Skip to content

Website Widget

The Website Widget is an embeddable live-chat widget for your website. Visitors can start a conversation from any page, and those chats land in your unified Inbox where your AI agent replies.

  1. In the left sidebar, open AI Agents, then select Connect channels and pick the Website Widget card on the right side of the map. A drawer titled Website Widget opens.

  2. Under Turn on Website Widget, select Turn on. Only an admin can do this.

  3. Under Put the widget on your website, add your site under Allowed website domains. Enter hostnames only, such as example.com and www.example.com, one per line. Leave out https://, paths, ports, and wildcards. Then switch on Enable widget and select Save configuration.

    The Website Widget drawer
    Website Widget drawer: turn on the channel, then add allowed website domains

    The Website Widget drawer

  4. Once the channel is on, the drawer lists more settings. Under Status & appearance, tune Primary color, Launcher position (e.g. Bottom right), and the Greeting message. You can also toggle the “Powered by Kasbly” label.

  5. Open Embed code, copy the snippet, and paste it before the closing </body> tag on your site.

  6. Open Public key & URLs to confirm the widget is Enabled and the channel is Connected to your agent. The HTTP and WebSocket endpoints the embed uses are listed here, along with deployment guidance for your web team. If your site sets a Content-Security-Policy, allow the widget script in script-src, the API and WebSocket origins in connect-src, and the API origin in frame-src. The chat session runs in a hidden frame on the API origin, so without frame-src the bubble appears but every visitor message stays pending.

To open the chat from a button or link on your page, such as “Chat with us” on your contact page, ask your web team to call open():

<button onclick="window.__kasblyWidget?.open()">Chat with us</button>

open() shows the chat window, even when the launcher is collapsed or the channel picker is showing, and leaves an already open window open. close() closes it. Both do nothing on pages where the widget has not loaded, and open() does nothing when Live Chat is turned off.

If your customers sign in to your site, end the widget chat when they sign out. Otherwise the next person on a shared browser, such as a family computer, opens the widget and sees, and writes into, the previous customer’s conversation.

Ask your web team to call logout() from your site’s sign-out handler:

async function signOut() {
// End the widget chat before the site session goes away.
await window.__kasblyWidget?.logout();
await fetch('/account/sign-out', { method: 'POST', credentials: 'include' });
window.location.assign('/');
}

logout() ends the visitor’s session and clears the saved conversation and any name or email they entered. The next message starts a new visitor. The ?. keeps the handler working on pages where the widget has not loaded.

The embed snippet sets tenantId and apiUrl. Your web team can add these optional settings to window.__kasbly on a single page:

  • locale: 'en' or 'ar'. Sets the widget language. If you leave it out, the widget follows the page’s <html lang>.
  • greeting: an opening line for this page only, instead of the greeting set in the dashboard.
  • position: 'bottom-left' or 'bottom-right'. Moves the launcher for this page only.
<script>
window.__kasbly = {
tenantId: '<your tenant ID>',
apiUrl: '<your API URL>',
locale: 'ar',
position: 'bottom-left',
};
</script>