Skip to content

Customize your chat by adding your JavaScript code

The RWC client has a robust functionality. The RWC Steps provide numerous settings for you to tailor your chat appearance and behavior according to your business needs and tastes. Whenever the provided settings are not enough to make the chat client look and behave as you need, you can always customize your chat by adding your JavaScript code.

We provide the Send JavaScript Code(RWC) Step that you can add to the Flow wherever you need it. Once the Flow reaches the Step, it will execute on the RWC client the JavaScript code written in the Step. For example, with the code in the Step you can change RWC client colors, add a header or any other element, play sound, open a link or close the chat tab programmatically, record some user information to the Local Storage, send API request, etc. However, if you need your JavaScript code to be executed once the chat is loaded, you can write your JavaScript code in the Wait for Chat (RWC) Step Advanced settings, below the enabled Extend page <head> by custom template toggle. If you want the execution of your JavaScript code to be triggered by the chat user's action on the client, you can add your JavaScript in the Set up Global Actions (RWC) Step.

In the RWC, you can also customize a standard RWC message input and a standard Content area. Sometimes standard RWC input components do not provide the functionality to build the message you need. For example, you need to show a preview tooltip when the chat user hovers the button in the message. To add this functionality to the standard RWC message input component, you can write the JavaScript code in the Custom template component of the Request Response (RWC) Step template. As for the Content area, if the standard HTML page with media does not meet your needs, you can customize it by adding your JavaScript code in the Manage Content Area(RWC) Step. For example, it can be used to generate and show charts in the Content area of your chat.

All in all, the RWC provides numerous ways to customize your chat with added JavaScript code.