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. Once the channel exists, the full settings tabs below appear.

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 ⌄ 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.Page prompts and Office hours and replies come next. See Suggested questions and page prompts and 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

After generating a key on the Install tab, copy one of the snippets it provides and add it to your site.
1

Create a publishable key

On the Install tab, click Create Application & Key if you don’t already have a publishable key.
2

Copy the snippet

Copy either the React / Next.js component snippet or the HTML / Script Tag snippet. Both already include your API key and Channel ID.
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 in the position you chose under Settings → Appearance.
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.

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.