Skip to main content
The SquawkVoice Chat Widget lets you place an AI chat assistant directly on any webpage. Visitors can type questions and get instant, intelligent responses — powered by the agent you built in the Studio. This guide walks you through embedding the widget, customizing how it looks, and optionally passing customer details (like a name or account ID) so the agent can personalize every conversation.

Before You Start

Make sure you have:
  • An agent built and saved in Build → AI Agents
  • The assistant ID and public key for that agent (found under Chat Configuration → Embed Code, with the key also shown as Widget Key in Widget Config)
  • The address of each website that will carry the widget, such as https://www.example.com — you’ll add it to the agent’s Allowed Origins list in Step 1
  • Access to your website’s HTML source code

Step 1 — Add the Widget to Your Website

The widget is a small piece of HTML you paste into your website. It loads as a floating chat button, usually in the bottom-right corner of the page. Everything about the widget is managed from one place in the Studio: open your agent and go to Chat Configuration. It is a single page with three sections, in this order —
  • Embed Code — the theme and version dropdowns, and the snippet to copy
  • Widget Config — Allowed Origins, Chat Variables, and your Widget Key
  • Customize Widget — how the widget looks (logo, avatar, name, disclaimer, position, size and colors) and its Proactive notification
The Freshchat connection used for escalating a chat to a person is no longer set here. It has moved to Handoff → Chat → Handoff Platform on the agent — see Chat Escalation.

Get Your Embed Code

  1. Open your agent in Build → AI Agents.
  2. Go to Chat Configuration. The Embed Code section is at the top.
  3. Open the version dropdown (the one with the tag icon) and choose a version. Leave it on Latest (2.0.0) unless you need to pin a specific release. Versions 1.0.0 through 1.4.0 are still available to pin.
  4. Open the theme dropdown and choose your starting theme: Default (Light) or Dark. Visitors can still switch between light and dark with the sun/moon button in the widget header.
  5. Copy the generated embed snippet with Copy.
The theme dropdown only changes the snippet — it is not a saved setting, and Studio does not remember it. Pick it again whenever you copy a fresh snippet. If you change the theme (or the version) after you’ve pasted the snippet into your site, paste the updated snippet over the old one.

Widget Versions

The version you pick controls only which loader file your snippet points at. The chat experience itself is not version-pinned — it is always the current release — so appearance and behavior improvements reach every page that already has the widget embedded, with no change on your side.
Agents that were previously pinned to an older widget version have been moved to Latest. If you need a specific loader file, re-pin it under Chat Configuration → Embed Code.

Allow Your Website

The widget only works on websites you have approved, and an agent has none approved until you add them. Add your site before you test, or visitors will not be able to start a chat.
  1. In Chat Configuration, find Widget Config → Allowed Origins.
  2. Type your website’s address, for example https://www.example.com, and click Add Origin.
  3. Studio asks you to confirm. Check that the address is correct and one you trust, then click Add Origin in the dialog.
Repeat for every site that will carry the widget. To take one off the list, click the X beside it. A change to the list applies to your live site at once, with no Publish. An origin is the web address up to the end of the domain, and nothing more:
  • Start with http:// or https://.
  • Leave out any path. Use https://www.example.com, not https://www.example.com/contact. A trailing slash is removed for you.
  • Add a port only if the site uses a non-standard one, such as http://localhost:3000. The same domain on a different port is a different origin.
  • Each domain and subdomain needs its own entry. https://example.com and https://www.example.com are different origins, so add both if your site answers on both. Wildcards such as *.example.com are not supported. Studio may still let you save an entry like https://*.example.com without showing an error, but it never matches a real site, so a site covered only by that entry stays blocked.
  • Type the address in lowercase. Studio doesn’t accept capital letters in an origin.
If an address breaks one of these rules, such as having a path or no http:// or https://, Studio shows Invalid origin. Use http(s):// with host only (e.g., https://example.com).
Until at least one origin is on the list, Studio shows “You must add at least one origin before the chat widget can be used,” and no visitor can start a chat. On a site that isn’t on the list, the chat button may not appear, and the chat can show Access Denied — see What the error screens mean.

Paste It Into Your Page

Open your website’s HTML and paste the snippet just before the closing </body> tag. On Latest, it looks like this:
If you chose Dark, the <squawkvoice-widget> tag also carries theme="dark".
Replace the placeholders before you add the snippet to your site. The <script> block at the top lists the built-in email key and any chat variables you have mapped, each with a placeholder such as <REPLACE-WITH-EMAIL>. A placeholder is deliberately not valid JavaScript, so until you swap in a real value the browser reports a script error and no values are passed to the agent. The chat button and the chat itself still load. Part C below shows how to fill the values in. If you don’t want to pass any customer details, delete the whole block — visitors will then be asked for their email address (see What Visitors See First).
Save your file and reload your site. Once your site is on the Allowed Origins list, the chat button should appear.
The defer attribute on the script tag means it loads after the rest of your page, so it won’t slow down your site’s initial load time.

What Visitors See First

Unless your page passes the visitor’s email address, the chat opens on a Welcome! screen: “Before we get started, please fill out the details below.” The visitor types their address into Enter your email address and clicks Start. The address needs to look like a normal email address — otherwise the screen says “Email is required” or “Invalid email format. Please enter a valid email address.” Once they start, that email address identifies the visitor for the chat, and it is how a returning visitor is matched to their earlier chat (see When a Chat Ends). There is no Studio setting that turns this screen off. To skip it, pass the visitor’s email from your page — see Skip the Email Screen. A visitor who selects New session sees the screen again unless your page passes an email.

Your Widget Key

The public key in your snippet is also shown as Widget Key under Chat Configuration → Widget Config, with Copy and Regenerate buttons. Selecting the key itself also copies it. Replacing the key takes effect at once, with no Publish.
Regenerate creates a new key and invalidates the current one. Any page still using the old key stops working until you paste in the updated snippet, so you’ll need to update the key everywhere the widget is installed. Studio asks you to confirm in a Regenerate Widget Key dialog, which shows the current key. Your Allowed Origins stay in place.

Step 2 — Customize the Widget’s Appearance

You can change how the widget looks directly from the Studio — no code changes needed. These controls live under Chat Configuration → Customize Widget. The light or dark starting theme is not set here — it comes from the theme dropdown in Embed Code (see Get Your Embed Code). Widget Logo and AI Agent Avatar accept PNG, JPG, GIF and WebP files up to 10 MB. SVG is not supported. Click the X on an uploaded image to remove it. You can also set either image from the Squawk Co-pilot: attach the image with the paperclip and say which one it is for. The Co-pilot asks first, on a card with an Upload file button. Like any other change here, the new image goes to the agent’s draft, so on an agent you’ve published it reaches your site at your next Publish. At the top of Customize Widget are two buttons:
  • Show Preview opens a floating, live preview of the widget so you can see changes as you make them. It becomes Hide Preview while the preview is open.
  • Reset to Defaults restores the default colors, position and size. Your uploaded logo, AI Agent Name, AI Disclaimer, Proactive notification and widget version are left as they are.
You don’t need to update the embed code when you change these settings. Edits save to the agent’s draft as you make them, and any pending change is written out when you leave the panel. For an agent that has never been published, your site shows the saved settings straight away. Once the agent has been published, your site keeps showing the published settings until your next Publish: see What Waits for Publish. Show Preview and the Studio’s test chat always show your latest edits, not the published version. A few things work differently. Allowed Origins and the Widget Key apply to your live site as soon as you change them, with no Publish. The widget version never waits for a Publish either, because it only changes the snippet you copy: paste the updated snippet into your site. On your site, the launcher stays hidden until its saved position, size, color and logo have loaded, so it fades in already branded rather than flashing in the default corner first. Or ask the Co-pilot. Ask the Squawk Co-pilot to look at or change an agent’s chat widget and it works on the same settings as Chat Configuration: the corner and the Compact or Full size, the five colors for Light Mode and Dark Mode (as hex values such as #3B78EE), the AI Agent Name and AI Disclaimer, the Proactive notification, and the widget version. It can reset the colors, corner and size as Reset to Defaults does, and remove the Widget Logo or AI Agent Avatar; a new image still goes in by attaching it, as described above. It changes only what you name, and only the color mode you name, so unlike the color pickers it doesn’t work out a Dark Mode color from a Light Mode one. For Chat Variables, it can map a key your page passes to a chat variable, creating the variable if it doesn’t exist, set that row’s DEFAULT VALUE and TEST VALUE, or remove a mapping. Ask for the embed code and the reply shows it in an EMBED CODE card with a Copy button. Two changes reach your site the moment you confirm, so the Co-pilot asks first, on a card with Yes, go ahead: setting which websites may embed the widget, which replaces the whole Allowed Origins list, and replacing the Widget Key, which stops every site using the old key until you paste in the new embed code that the reply shows. Every other change goes to the agent’s draft, so on an agent you’ve published it reaches your site at your next Publish, except a new widget version, which only takes effect once you paste the updated embed code into your site, and a TEST VALUE, which only the Studio’s test chat uses. The Co-pilot can’t publish for you.

Proactive Notification

Rather than waiting for a visitor to click, the widget can invite them to chat first. A small teaser bubble appears beside the closed launcher, showing a short message you write. Configure it under Chat Configuration → Customize Widget → Proactive notification. Message and Delay (seconds) only appear once the Proactive notification toggle is on.
Proactive notification is on by default — including for widgets that are already embedded and live on your site. Nothing needs to be redeployed for it to start appearing, because the widget reads its settings fresh on every page load. If you would rather not use it, open each agent and clear the Proactive notification toggle under Chat Configuration → Customize Widget. On an agent you’ve published, the bubble keeps appearing until your next Publish.

Behaviour worth knowing

  • The bubble appears only when all of these are true: the widget started minimized (the launcher is closed), the visitor isn’t returning to a chat from the last 10 minutes, they have never opened the chat in that browser, they haven’t dismissed the bubble on this visit, and the delay has elapsed.
  • A visitor can dismiss the bubble with the X that appears when they hover over it. Dismissing hides it for that visit only, so it can come back the next time they visit.
  • Once a visitor opens the chat, the bubble does not show again in that browser. This is remembered in the visitor’s own browser, separately for each agent.
  • As with the other appearance settings, you don’t need to touch the embed code. A change reaches your site straight away for an agent that has never been published, and at your next Publish for one that has.
Keep the wording short and welcoming, and phrase it as an invitation rather than a question the agent then has to answer twice.

Step 3 — Pass Customer Data Into the Chat (Optional)

This is one of the most powerful features of the widget. You can tell the agent who the customer is before they type a single word — things like their name, email address, subscription plan, or account ID. Think of it like giving your agent a briefing sheet before starting a conversation.

How It Works (Plain English)

  1. You define which pieces of customer information you want to share — these are called chat variables.
  2. You map each piece of information to a named slot in the agent (e.g., "customerName" → the agent’s interaction.CHAT.customer_name variable).
  3. When your page loads, your JavaScript puts the actual customer values into a global object called window.SquawkVoiceChatVariables.
  4. The widget reads those values, strips them from the browser window (so other scripts can’t snoop on them), and sends them securely to the agent’s session.
  5. The agent can immediately use those values — in its greeting, its guidelines, or any API calls it makes on the customer’s behalf.
Chat variables require widget version 1.1.0 or later, and passing the visitor’s email requires 1.2.0 or later. If you’re on latest, you’re already covered.

Skip the Email Screen

email is the one key that is built in. If your page passes a valid email address for it, visitors go straight into the chat and the Welcome! screen is skipped.
  • You don’t create or map it. The first row of Chat Variables is always email, read-only, linked to interaction.CHAT.email with DEFAULT VALUE Provided at runtime. You can’t add your own email key or create that variable — so leave it out of Parts A and B below, and just pass it in Part C.
  • The value has to look like an email address. If it is missing, blank or not a valid address, visitors see the Welcome! screen as usual.
  • The agent can use it. The address is available to the agent as {{interaction.CHAT.email}}.

Part A — Create the Variables in the Studio

Before the widget can pass any data, the agent needs somewhere to store it: a chat widget variable whose name starts with interaction.CHAT.. You can create these ahead of time here, or skip this part and create them as you go in Part B.
  1. Open your agent and go to its Variables card (see Variables Manager).
  2. Click Create variable.
  3. Set Type to Chat widget. (The other choice, Custom, is for variables the widget doesn’t fill in.)
  4. In Name, type the part after the fixed interaction.CHAT. prefix — for example customer_name. Studio adds the prefix for you.
  5. Click Create variable to save.
Use letters, numbers and underscores. Start with a letter, don’t end with an underscore, and keep the name to 64 characters or fewer. Example variable names:

Part B — Set Up the Mappings in Widget Config

This step connects your JavaScript keys (what you’ll type in your website’s code) to the agent variables.
  1. In your agent, go to Chat Configuration → Widget Config → Chat Variables. It is a table with the columns KEY, VARIABLE, DEFAULT VALUE and TEST VALUE.
  2. Click the empty Add key… row at the bottom of the table, type the name you’ll use in your JavaScript (e.g., customerName), and press Enter (or click away). The key is saved as a new row straight away.
  3. In that row’s VARIABLE column, open Select or create variable. Pick a variable you created in Part A, or type a new name and click Add Variable — the variable is created with the interaction.CHAT. prefix and mapped in one step.
  4. Optionally fill in the row’s other two columns. They stay greyed out until the row has a variable.
    • DEFAULT VALUE — a fallback if the page doesn’t provide a value (e.g., Guest)
    • TEST VALUE — a sample value used only in the in-platform test chat (e.g., Sarah Johnson)
To remove a mapping, click the X at the end of its row and confirm with Remove in the Remove mapping? dialog. The variable itself isn’t deleted and can be mapped again later.
Mappings you add, change or remove are saved to the agent’s draft, DEFAULT VALUE included. The live widget only accepts keys that are mapped in the agent’s live version, so on an agent you’ve published, a key you add is ignored until your next Publish. The built-in email key is always accepted.
Use the DEFAULT VALUE column for things like a customer name — set it to Guest so the agent always has something to work with, even for anonymous visitors.

Preview With Test Values

Every mapping has a TEST VALUE column so you can preview variable-driven behavior without touching your website:
  1. Enter a test value next to each mapping (e.g. Sarah Johnson for customerName).
  2. Open the in-platform test chat — the agent session is seeded with your test values, exactly as if the live page had passed them.
Test values are strictly a Studio-side tool: they are stripped from the widget configuration served to your website and are never sent to real visitor sessions.
Do not enter real customer information in Test Value fields — use representative sample data.
Key naming rules:
  • Must start with a letter (not a number or symbol)
  • Can only contain letters (a–z, A–Z), numbers (0–9), and underscores (_)
  • Cannot end with an underscore
  • Maximum 64 characters
  • Each key must be unique, and each variable can be mapped to only one key
  • email is reserved, in any capitalization — it is the built-in key described in Skip the Email Screen
Valid examples: customerName, account_id, planTier2 Invalid examples: 123customer, my-key, customer.name, plan_

Part C — Inject the Values on Your Web Page

On your website, define the window.SquawkVoiceChatVariables object in a separate <script> block that appears before the widget loader script. Use the exact key names you set up in Part B, plus email if you want to skip the email screen. The snippet Studio gives you already contains this block, with one placeholder for email and one for each mapped key that has a variable. Replace each placeholder with the real value. Values can be text, numbers or true/false, and they reach the agent as text:
In a real application, you’d replace the hardcoded values with dynamic ones from your server or session:
The window.SquawkVoiceChatVariables script block must come before the <script src=".../squawk-chat-widget.js"> tag. If the loader runs first, it won’t find your variables.

What Visitors See in the Chat Window

Besides the branding you set, the chat window has a few things you don’t configure:
  • Header controls. New session starts a fresh chat (it is turned off while the chat is still connecting). The sun/moon button switches between light and dark. The X minimizes the chat back to the launcher.
  • Powered by SquawkVoice.ai. A small link with this label sits under the message box, and under the Start button on the email screen. There is no Studio setting to remove it.

When a Chat Ends

A chat that’s still open ends by itself after 24 hours with no message from the visitor or the agent, the same as a normal close, as long as the visitor’s page stays open. The widget shows your agent’s Closing message (Greeting & Sign-off → Chat), then “Session ended. Start a new session to continue.” and locks the message box. The visitor can select New session to start a fresh chat. The 24 hours can’t be changed. If a visitor closes the page or leaves, their chat is held for about 10 minutes. A visitor who reloads or comes back within that time picks up the same chat. If they are away longer, the earlier chat is ended and they start a new one. A page that is simply left open does not count as leaving. A chat that has been handed to a human agent follows the handoff limits instead. See How Long a Handoff Lasts.

What Happens Behind the Scenes

You don’t need to understand this to use the widget, but it helps to know the widget is designed with security in mind.
  1. The loader reads your variables — When the widget loader script runs, it immediately reads whatever is in window.SquawkVoiceChatVariables.
  2. It deletes the global object — The loader then removes window.SquawkVoiceChatVariables from the browser window, so other scripts on the page can no longer access that customer data.
  3. Values are sanitized — Keys and values are validated: text, numbers and true/false are accepted and sent as text; other types (objects, arrays, functions) are dropped; values are capped at 500 characters.
  4. A secure session is started — The widget establishes an authenticated session with the SquawkVoice backend using a challenge-response handshake. Your variables are sent as part of this secure session setup.
  5. The backend validates mappings — The backend only accepts keys that are explicitly configured under Chat Configuration → Widget Config → Chat Variables (for an agent you’ve published, the mappings as they were at its last Publish), plus the built-in email key. Any extra keys sent from the page are silently ignored.
  6. Variables become available to the agent — Once the session is established, your agent can reference these values in its greeting, guidelines, or in-conversation actions.

Limits & Constraints


Troubleshooting

The chat button doesn’t appear.
  • Check that your website’s address is on the agent’s Allowed Origins list (Chat Configuration → Widget Config → Allowed Origins), spelled exactly as visitors reach it — https://example.com and https://www.example.com are separate entries.
  • Give it a moment. The launcher is deliberately hidden while its saved appearance loads, so it fades in already branded instead of flashing in the default corner. It will always appear within about 10 seconds — falling back to the default corner, size and color if that request is slow or fails.
  • Check that both the <squawkvoice-widget> tag and the <script src="..."> tag are present in your HTML.
  • Make sure the assistant-id and public-key attributes are filled in with your actual values (not placeholder text). If you regenerated the Widget Key, paste in the updated snippet.
  • Check your browser’s developer console (F12) for any JavaScript errors.
The chat says “Access Denied”.
  • The message reads “This chat cannot be accessed from this website.” It means the page’s address isn’t on the Allowed Origins list, or the list is empty. Add the exact address under Chat Configuration → Widget Config → Allowed Origins — see Allow Your Website.
Visitors see “Something Went Wrong” when they open the chat or send their first message.
  • That is a general message with a Try Again button, so it can have more than one cause. One cause is a wallet balance that can’t cover a chat session. Each chat session is charged to your wallet when the visitor sends their first message, and the balance is checked when the chat opens and again at that first message. A visitor can’t start a chat when the balance is too low to pay for one, and if it falls too low in between, the screen appears after their first message and that message isn’t answered.
  • The visitor isn’t told why, but you can see it in Chat History. A chat refused when it opens is listed as a REJECTED row with INSUFFICIENT_BALANCE as its Disposition, and Chat Analytics counts it as Insufficient-Balance. A chat refused at the first message is listed with the same Disposition and a cost of $0.00. A refused chat is never billed. See Chat History.
  • Check your balance under Manage → Billing → Overview, then add credits or turn on auto top-up. Billing isn’t in an account user’s default sidebar. See Navigating Studio to add it or find it with search.
Visitors are asked for their email address before they can chat.
  • That is the Welcome! screen, and it is on by default. To skip it, pass a valid email for each visitor — see Skip the Email Screen.
  • If you already pass email and visitors still see the screen, check that the value is a real email address, that the script block comes before the loader script, and that you’re on widget version 1.2.0 or later.
My customer variables aren’t reaching the agent.
  • Confirm the window.SquawkVoiceChatVariables script block is placed before the widget loader script in your HTML.
  • Confirm you replaced every <REPLACE-WITH-…> placeholder in the snippet. While one is still there, the browser console shows a script error and no values are passed.
  • Check that your key names match exactly what you configured under Chat Configuration → Widget Config → Chat Variables — they are case-sensitive.
  • If the agent has been published, check that you published after adding the mapping. A key added since the last Publish is ignored by the live widget.
  • Make sure your keys follow the naming rules (start with a letter, no hyphens or dots, no trailing underscore).
  • Verify you’re using widget version 1.1.0 or later — check the src URL or set it to @latest.
The agent doesn’t use the variable values I passed.
  • Confirm each mapping points at a matching interaction.CHAT.* variable on your agent’s Variables card.
  • Confirm each mapping under Chat Configuration → Widget Config → Chat Variables has both a KEY and a VARIABLE selected.
  • Check that the variable is referenced correctly in your agent’s guidelines (e.g., {{interaction.CHAT.customer_name}}).
I’m seeing “Guest” instead of the customer name.
  • Your default value is working as intended — it means the page didn’t pass a value for that key. Check that window.SquawkVoiceChatVariables is being set with the correct data before the widget loads.
My widget changes don’t show on my site.
  • If the agent has been published, your site shows the published settings until you publish again. Look in the agent’s header: Unpublished edits means changes are waiting. Select Publish, review the changes, and choose Confirm & Publish. See Publishing Your Agent.
  • Show Preview and the Studio’s test chat always show your latest edits, so they can differ from your site until you publish.
  • Allowed Origins and the Widget Key don’t wait for a Publish, and a new widget version only takes effect once you paste the updated snippet into your site.
  • Reload the page. The widget reads its settings each time a page loads.
A chat variable can’t be deleted.
  • Studio shows “Cannot delete variable while it is still used: the published chat widget of “agent name” maps it. Publish the agent first, then delete the variable.” The agent’s live version still maps that variable, even if you have since removed the mapping from Chat Variables. Remove the mapping if it is still there, Publish the agent, then delete the variable.

What the error screens mean

When the widget can’t load or start a chat, it shows one of these screens in place of the chat. Each has a Try Again button.