Add chat to your Knowledge Base

Learn how to embed chat on your Kustomer Knowledge Base.

You can embed Kustomer Chat on your Kustomer Knowledge Base. To embed Kustomer Chat on your website or web app, see Add chat to your website.

To add chat to your Kustomer Knowledge Base, you'll add the configured Web SDK code to a Global JavaScript file to use with your custom Knowledge Base theme.

Prerequisites

Before you get started, you'll need the following:

  • The API key from the configured Web SDK code for your Kustomer organization or brand. To learn more, see Chat Management: Install Chat in the Kustomer Help Center.
  • Access to a custom (that is, not the default theme) Knowledge Base theme in Kustomer.

πŸ‘

Note: Add chat to customer Knowledge Base themes

You can only add new files for custom Knowledge Base themes.

Step 1: Create a new Global JavaScript file

First, create a new Global JavaScript file with the name chat for your customized Knowledge Base theme.

To add the JavaScript file:

  1. Go to Settings and select Knowledge Base > Themes > [Your custom theme] to open the editor for the selected custom theme.

  2. In the theme editor, locate the Theme Files panel (contains three sections: Pages, Components, and Globals). Select + Add to open the Create Theme File modal.

  3. In the Create Theme File modal, select or enter the following:

    • Theme Target: Global
    • File Name: chat
    • File Type: JS

    Select Create to open the editor for the new file in Kustomer. You'll also see chat.js listed under Globals in the Theme Files panel.

Create Theme File modal for Kustomer Knowledge Base.Create Theme File modal for Kustomer Knowledge Base.

Create Theme File modal for Kustomer Knowledge Base.

Step 2: Edit the new chat.js file

Next, edit the new chat.js file with code that will display the chat icon in the bottom right corner of your Knowledge Base.

To edit the chat.js file:

  1. Copy and paste following code into the empty chat.js file.
window.addEventListener('DOMContentLoaded', function () {
     var script = document.createElement('script');
     script.src = 'https://cdn.kustomerapp.com/chat-web/widget.js';
     
     // Replace API_KEY with your API Key 
     script.setAttribute('data-kustomer-api-key', 'API_KEY');
    
     var body = document.getElementsByTagName('body')[0];
     body.appendChild(script);
   });
   
   window.addEventListener('kustomerLoaded', function () {
     Kustomer.start();
   });
  1. Replace API_KEY with the API key from the Web SDK code for your Kustomer organization or brand. To learn more, see Chat Management: SDK.

  2. Select Save to save your changes.

Sample chat.js code in Knowledge Base theme editor for custom theme.Sample chat.js code in Knowledge Base theme editor for custom theme.

Sample chat.js code in Knowledge Base theme editor for custom theme.

The chat widget icon will now appear on the bottom right corner of your custom Knowledge Base when apply the saved theme.


Did this page help you?