Skip to main content
The chat widget lets website visitors message your team in real time. You configure its appearance and behaviour in Settings → Chat Widget, then drop the generated snippet on your site.
The widget is backed by a Chat Widget channel. If you haven’t created one yet, the settings screen shows a Create your chat widget card. Enter a Widget name (defaults to Support Chat) and click Create Chat Widget. The screen then opens on the Install tab, with the code ready to copy.

Configuration

All settings live under Settings → Chat Widget, split across tabs. Changes are saved with the Save changes bar that appears at the bottom of the page once you edit something. They are not saved automatically as you type.
The Settings tab holds the core configuration.AppearanceIf a visitor moves to another page while the chat is open, it stays open on the new page, with anything they typed and hadn’t sent. On a phone it closes instead, so it doesn’t cover every page they visit.Visitors put the chat away with the ⌄ (Minimize chat) in its header. The ⋯ beside it starts a new chat, opens past chats, or ends this one. End chat asks once, then closes the conversation for your team as if a teammate had closed it, and offers Start a new chat in place of the message box, with a 👍 / 👎 asking whether the chat helped. A rating shows in the conversation as a note only your team sees (“Visitor rated this chat: Helpful 👍”). The same happens when a teammate closes a chat. While a chat is under way, the Ask bar says “Continue your chat…” instead of “Ask anything…”, and shows the newest reply with a dot when one arrives while the chat is put away.A live preview of the real widget sits beside these controls and updates as you change them, before you save. Text on the brand and accent colors is picked for you: a light color such as yellow gets dark text, so the header and buttons stay readable.Office hours and replies and If nobody answers come next. See Office hours and email follow-up.FeaturesVisitor Sync
Pair Sync Visitors to Object with the Intake Form tab so the contact details a visitor submits are written straight to a record. See Visitors for how synced visitor data behaves.
Known customers sets what a customer your server identified sees: a greeting by name, their record’s owner, and booking on the owner’s calendar. See Known customers.

Embedding the widget

Copy the code from the Install tab and add it to your site.
1

Pick your platform

On the Install tab, pick where your site is built. The tab shows the steps for it.
2

Copy the code

Click Copy code. It already includes your publishable key and your widget.
3

Add it to your site

Paste the HTML snippet just before the closing </body> tag, or render the React component in your app. The widget appears where you chose under Appearance on the Settings tab.
Always copy the snippet straight from the Install tab. It is wired to your specific widget. It already includes your publishable key and channel, so you don’t need to fill in any IDs by hand. The widget picks up the greeting and appearance you set on the Settings tab.

How the script loads

The HTML snippet loads a small script, about 7 KB, that draws the launcher. The chat itself downloads when a visitor reaches for it: their pointer moves over the launcher, they tab to it, or they tap it. Until then your pages load as if the widget weren’t there, and nobody is counted as a visitor. A visitor who clicks before the chat has arrived sees a spinner in the launcher, and the chat opens as soon as it’s ready. The chat loads straight away for a visitor with a conversation under way, so your team’s replies keep arriving, and on a page with a page note due to show. To host the files yourself, serve widget.js and widget-app.js from the same folder. Both ship in the @custral/widget package.

Control the chat from your page

The script adds a CustralChat object to your page. Every call works before the chat has loaded: open() loads it first.
To open the chat from a button or a link with no code at all, add data-custral-open. With a value, it opens a new chat with that message ready to send:
The chat starts loading as soon as a visitor points at one of these. If the chat can’t open (for example, the key was removed), a link with data-custral-open still goes to its own href. When the chat closes, focus goes back to the button or link that opened it.

What the widget reads from your page

With each message, the widget sends the page’s address (without anything after ?), its title, and the text visible on the page, so your AI agent can answer from what the visitor is looking at. The page text goes to the AI agent only, and isn’t saved with the message. To keep a part of a page out, such as an account panel, mark it data-custral-ignore:
See What the widget sends about the page.

Identifying a known visitor

If your visitors sign in to your site, tell the widget who they are. Mint an identity token on your server and pass it as identityToken, in CustralChat.init or on <CustralChatWidget>. The visitor is then recognised on every device and treated as a known customer: greeted by name, with their record’s owner. You can also pass a visitor with a name and email. It skips the intake questions, but anyone could send any email that way, so it only fills empty fields on a record and never replaces what’s there.

Signing a visitor out

The widget remembers its visitor in the browser, so a returning visitor picks up where they left off. On a shared computer, that means the next person to use your site picks up where the previous person left off, conversations included. When someone signs out of your site, have the widget forget them:
reset() forgets this browser’s visitor and restarts the widget as a new, anonymous visitor. It does not reuse the identityToken the widget was loaded with. To sign the next person in without a page load, remove the widget and load it again with their token:
In a React app, call resetCustralChat() from @custral/widget instead. See the React SDK.
Conversations of a visitor signed in with an identity token stay theirs even without reset(): the widget only reopens them on a page that passes that person’s token. reset() covers everything else, such as a chat from someone who never signed in, or a site that identifies visitors with visitor instead of a token.

Security

Anything a visitor types into the chat, an email included, is unverified: anyone can type a customer’s address. To vouch for a signed-in customer, your server mints an identity token with POST /v1/widget/visitor-tokens, using your secret key, and your page passes the short-lived token to the widget. Never mint it in the browser. See Widget identity. A visitor with a token can replace the details on their record, where a typed email only fills empty fields. To keep everyone else out of your CRM, turn on Only add visitors your server has identified under Visitor Sync.

Troubleshooting

Chat & Widget overview

How the embeddable widget and human hand-off fit together.

Visitors

How widget visitors are tracked and synced to records.