Livechat Widget Javascript API

This guide helps your team get more value from TurboHelp's Live Chat tools. Use it to understand the feature, configure it correctly, and know what to check before relying on it in your daily support workflow.

At a Glance

  • Use the live chat widget to support visitors in real time without forcing them to leave your site.

  • Configure identity, routing, forms, and campaigns before driving production traffic to the widget.

  • Test the widget on desktop and mobile after every meaningful configuration change.

The TurboHelp Live Chat JavaScript API gives developers direct control over the widget from your website code. Use it to open or close the chat, pass known user details, react to widget events, and create a more connected customer experience.

Important: This article is intended for developers or site administrators who are comfortable adding JavaScript to a website.

Loading the Widget

The API becomes available after the TurboHelp live chat loader has finished loading. Place any widget settings before the loader script, then run API calls after the widget is ready.

window.BeChatSettings = {
    user: {
        name: 'John Appleseed',
        email: '[email protected]'
    }
};

<script src="https://your-turbohelp-domain.com/livechat-loader.js"></script>

onLoaded(callback)

Use the loaded callback before calling widget methods. This prevents errors when your page script runs before the chat widget is ready.

window.BeChat.onLoaded(function () {
    window.BeChat.open();
});

Open and Close the Chat

You can open or close the widget in response to your own website actions, such as clicking a "Contact support" button.

document.querySelector('#support-button').addEventListener('click', function () {
    window.BeChat.open();
});

document.querySelector('#close-support').addEventListener('click', function () {
    window.BeChat.close();
});

Identify Known Users

For logged-in customers, pass trusted user data from your application so agents can see who they are helping. If you pass an email address, enable identity verification so visitors cannot impersonate another customer.

window.BeChatSettings = {
    user: {
        id: '12345',
        name: 'Jane Customer',
        email: '[email protected]',
        plan: 'Premium'
    }
};
  • Open the widget from a custom support link or account dashboard button.

  • Attach plan, account, or subscription context to the customer profile.

  • Launch different AI agents or knowledge scopes on different areas of your site.

  • Keep the chat experience consistent with your site's own logged-in state.

Best Practices

  • Keep the first widget experience short: ask only for the information agents truly need.

  • Verify identity for logged-in users before exposing account-specific conversation history.

  • Check widget behavior on key pages after changing themes, forms, or security rules.

Have more questions? Can't find what you're looking for? Our support team is here to help.
Submit a request We usually reply within 24 hours