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
- Open your agent in Build → AI Agents.
- Go to Chat Configuration. The Embed Code section is at the top.
- 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.
- 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.
- 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.- In Chat Configuration, find Widget Config → Allowed Origins.
- Type your website’s address, for example
https://www.example.com, and click Add Origin. - Studio asks you to confirm. Check that the address is correct and one you trust, then click Add Origin in the dialog.
- Start with
http://orhttps://. - Leave out any path. Use
https://www.example.com, nothttps://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.comandhttps://www.example.comare different origins, so add both if your site answers on both. Wildcards such as*.example.comare not supported. Studio may still let you save an entry likehttps://*.example.comwithout 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.
http:// or https://, Studio shows Invalid origin. Use http(s):// with host only (e.g., https://example.com).
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:
<squawkvoice-widget> tag also carries theme="dark".
Save your file and reload your site. Once your site is on the Allowed Origins list, the chat button should appear.
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.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.
#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.
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.
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)
- You define which pieces of customer information you want to share — these are called chat variables.
- You map each piece of information to a named slot in the agent (e.g.,
"customerName"→ the agent’sinteraction.CHAT.customer_namevariable). - When your page loads, your JavaScript puts the actual customer values into a global object called
window.SquawkVoiceChatVariables. - 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.
- 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 tointeraction.CHAT.emailwith DEFAULT VALUE Provided at runtime. You can’t add your ownemailkey 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 withinteraction.CHAT.. You can create these ahead of time here, or skip this part and create them as you go in Part B.
- Open your agent and go to its Variables card (see Variables Manager).
- Click Create variable.
- Set Type to Chat widget. (The other choice, Custom, is for variables the widget doesn’t fill in.)
- In Name, type the part after the fixed
interaction.CHAT.prefix — for examplecustomer_name. Studio adds the prefix for you. - Click Create variable to save.
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.- 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.
- 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. - 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. - 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)
- DEFAULT VALUE — a fallback if the page doesn’t provide a value (e.g.,
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.Preview With Test Values
Every mapping has a TEST VALUE column so you can preview variable-driven behavior without touching your website:- Enter a test value next to each mapping (e.g.
Sarah JohnsonforcustomerName). - Open the in-platform test chat — the agent session is seeded with your test values, exactly as if the live page had passed them.
- 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
emailis reserved, in any capitalization — it is the built-in key described in Skip the Email Screen
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 thewindow.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:
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.- The loader reads your variables — When the widget loader script runs, it immediately reads whatever is in
window.SquawkVoiceChatVariables. - It deletes the global object — The loader then removes
window.SquawkVoiceChatVariablesfrom the browser window, so other scripts on the page can no longer access that customer data. - Values are sanitized — Keys and values are validated: text, numbers and
true/falseare accepted and sent as text; other types (objects, arrays, functions) are dropped; values are capped at 500 characters. - 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.
- 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
emailkey. Any extra keys sent from the page are silently ignored. - 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.comandhttps://www.example.comare 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-idandpublic-keyattributes 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 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.
- 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.
- That is the Welcome! screen, and it is on by default. To skip it, pass a valid
emailfor each visitor — see Skip the Email Screen. - If you already pass
emailand 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.
- Confirm the
window.SquawkVoiceChatVariablesscript 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
srcURL or set it to@latest.
- 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}}).
- Your default value is working as intended — it means the page didn’t pass a value for that key. Check that
window.SquawkVoiceChatVariablesis being set with the correct data before the widget loads.
- 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.
- 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.