What the widget is
The website widget is the chat bubble that sits in the corner of your site. Visitors type or, when calls are on, talk to your assistant. Everything you can choose in the dashboard, such as colours, position, the launcher's label and whether visitors can call, is on Website chat. This page is the developer's side.
The embed snippet
<script src="https://<widget address>/widget.js" data-key="pk_live_…" defer></script>GoalThe chat bubble on your website.
- 1
Turn the widget on
On DeployChannelsWebsiteSettings, turn on Widget enabled.
- 2
Copy the snippet
From the Connection tab, or ask your developer to use the MCP tool
channels_get_widget_snippet. - 3
Paste it before
</body>on every pageIn a site builder, use its custom code or footer script setting. Only pages with the snippet show the bubble.
- 4
List your site in Allowed domains
So your key works only on your site.
- srcText
- The widget's loader,
widget.js. Use the address in your snippet. - data-keyText
- Required. Your website chat's public key:
pk_live_followed by 20 to 64 letters, digits,_or-. It is the only attribute the widget reads. - deferShown
- Loads the script without holding up your page. Keep it.
What happens on the page
- The small loader script checks
data-keyand draws the launcher: a round bubble, or a chat and a call button when calls are on with separate launchers. - It asks HeyServo for a session with the key. The colour, position, launcher text, logo and call button label come back with it, so design changes reach your site without touching the snippet.
- The full chat loads only when a visitor first clicks, and starts warming up when they hover. Your page stays light.
- The chat is drawn inside its own isolated element (
#heyservo-widget-host), so your site's CSS does not change it, and its CSS does not change your site.
- One widget per page. A second snippet on the same page is ignored.
- The visitor's identity is kept in the browser's local storage under
heyservo.visitor.{publicKey}, so the same browser is recognised when it comes back.
The JavaScript API
Once the loader runs, window.HeyServoWidget exists on the page.
- publicKeyText
- The
data-keythe widget was started with. - open()Button
- Opens the chat as if the launcher was clicked. It works once the chat has been loaded, that is after the visitor has opened it once on this page. Before that it does nothing.
- destroy()Button
- Removes the widget from the page.
<button id="chat-with-us">Chat with us</button>
<script>
document.getElementById("chat-with-us").addEventListener("click", () => {
window.HeyServoWidget?.open();
});
</script>The widget has no JavaScript events or callbacks. To react to what happens in chats, use webhooks on your server, for example conversation.started or lead.captured.
Allowed domains
List the sites that may show the chat in Allowed domains on the website chat's Settings. A site that is not listed shows nothing. With the list empty, any site that has your snippet can show it. Details are on Website chat.
When the bubble does not show
If the widget cannot start a session, it shows nothing at all, on purpose: a broken bubble is worse than none. Check these in order.
| Check | How |
|---|---|
| The snippet is on the page | View the page source and look for widget.js. |
| The key is valid | Open the browser console. [heyservo] missing or invalid data-key on the widget <script> tag means data-key is missing or mistyped. |
| The widget is on | Widget enabled on the website chat's Settings. |
| Your site is allowed | The page's domain is in Allowed domains, including www. if you use it. |
| The assistant still exists | Deleting an assistant deletes its website key. A new assistant has a new snippet. |