Customize the Chat Widget on your Website

This page is about Chat for JSM Cloud. Using Server or Data Center? Click here.

To change the appearance of the Chat Widget on an external website, you need to modify the widget’s HTML code that you’ve placed on the website, along with the CSS rules placed on the page.

For example, to change the icon color, add the following code to the web page where you placed the Chat Widget:

To change color:

Option 1

chatWidget = document.querySelector('chat-widget'); chatWidget.setAttribute('primary-color', '#2D60D8'); chatWidget.setAttribute('text-color', '#FFFFFF');

Option 2

<chat-widget primary-color="#2D60D8" text-color="#FFFFFF"> </chat-widget>

 

To add meta data:

Option 1

chatWidget.setAttribute('metadata', `[ { name: 'Age', value: 100, render: true, }, { name: 'Greeting', value: 'Hello world', render: true, }, { name: 'Hidden', value: 'hidden', render: false, }, ]`);

Option 2

 

To override default meta data:

 

To show the Widget button automatically:

Option 1

Option 2

 

To show the Widget button (e.g., if ‘auto-show' is set to 'false'):

 

To hide the Widget button:

 

To open the chat widget from any object in your website (not chat button only):

 

To define the callbacks or listen to the events:

Option 1

Option 2

 

To use the Widget in full-screen mode (the Conversation List will open automatically in full screen on the page or in a frame):

Option 1

Option 2

 

To notify your backend when a new message arrives:

 

Using ::part to Style Chat Widget Elements

To change the styles of specific Chat widget elements, you can use the ::part pseudo-element:

For example, to change the styles of the specific elements, add the following code to the web page where you placed the Chat Widget (inside <style> tag):

To change the style of the Chat icon in offline mode:

 

To change the style of the Chat icon button in the hover state:

To hide a specific Chat element:

Here is the list of Chat elements that can be customized using the ::part pseudo-element:

  • wrapper (the body of Chat)

  • icon-button (the button element with icon)

  • close-icon (the icon for closing the button)

  • offline-icon (the icon with offline icon)

  • online-icon (the icon with online icon)

  • authentication-section (element of logging/registering buttons in the home view)

  • attachment-button (the attachments button)

  • author-name (the author name on the conversations history view)

  • avatar (the avatar on the conversations history view)

  • button (every button)

  • header (Chat header bar)

  • header-close-icon (close button in the Chat header)

  • header-jira-ticket-icon (Jira ticket button in the Chat header)

 

 

The old version of the Chat Widget is no longer supported. We highly recommend that you switch to the new version by replacing the old code snippet on your website with the new one to ensure the best possible experience for your customers. You can find information about the customization settings for the old widget below.

To add iconClass to the chat configuration Javascript:

To add CSS rules:

To change the color of the top bar:

To change the color of the “New Conversation” button:

To change the color of the chat icon: