Install the web widget
Add the Live Chat widget to your website so that customers can start conversations. After you install the widget, set its language and test it.
Before you begin, make sure you meet the prerequisites in the quickstart.
Key terms [#key-terms]
The installation and authentication steps use the following terms:
- Widget: A component on your website where your customers start a conversation. The widget component includes an API to manage the chat sessions of your customers.
- Secret key: A unique private key that you use to generate a personalization token according to JSON Web Token (JWT) technology(opens in new tab).
- Personalization token: A specially generated JSON Web Token (JWT)(opens in new tab) that authenticates users and identifies them in the widget. Your backend service generates the personalization token. For details, see Generate the personalization token.
Install the widget [#install-the-widget]
Create the widget first. The installation snippet and the CSP sources appear only after that.
To install the widget on your website:
- Log in to your Infobip account.
- Go to Channels and Numbers → Channels → Live Chat, select your widget, and expand Installation and security.
- In Install Live Chat on your website, select Manual entry and copy the code snippet.
- Locate the main HTML frame in your website source code and paste the snippet between the
<head>tags. - Save and deploy your website application.
After you deploy your website, website visitors see the widget according to your widget configuration, for example, only on the allowed pages and during office hours.
The following example shows the snippet:
Replace <YOUR_WIDGET_ID> with the ID of your widget. The snippet that you copy from the widget configuration already contains the ID.
For website visitors, you might need to configure the Unauthenticated chat history retention setting. Set it to 24 hours.
The widget works on both HTTP and HTTPS websites, but use it on HTTPS websites only. Because HTTP is insecure, a malicious attacker can tamper with the website content, which makes the widget unsafe for sensitive communications.
Set the widget language [#set-the-widget-language]
Use the following options to control the language of the widget:
- Widget phrases: Select the Widget language in the general widget settings.
- Language at runtime: Use the
set_languagecommand of the JavaScript SDK. - Automatic messages: Add translations for welcome messages, quick replies, and other automatic messages. For details, see Translate automatic messages.
- Routing: Configure language-specific routing in Inbox (Conversations).
Test the widget [#test-the-widget]
After you install the widget, test it on the showcase page as a visitor and as an authenticated user. For the steps, see Test your widget.
Browser support [#browser-support]
The web widget supports the following browsers for web and mobile responsiveness:
- Google Chrome and other Chromium-based browsers
- Brave
- Edge (Chromium-based)
- Safari
- Mozilla Firefox
- Opera
When the browser window is 480 px wide or less, the widget fills the window. This also applies to narrow windows in desktop browsers.
For the frameworks that the mobile in-app chat supports, see Supported browsers and frameworks.
General settings
Set the widget name, display, threads, and language.
Audience and availability
Control widget visibility, pages, and scheduling.
Authenticate web users
Generate and submit a personalization token for logged-in users.
Content Security Policy (CSP) in Live Chat
Load the widget on websites that use a Content Security Policy.
Was this page helpful?