Skip to content

Web chat widget

The website widget is one script tag. It shows a chat window, a voice call, or both, depending on which channels the agent has on. Its look comes from the design you publish in Design Studio, so you can change the design without touching your website.

  • An agent with Web Chat (and, for calls, Voice over Web) turned on in its Channels, and published. Websites only reach the live version.
  • Or a use case with an entry agent. The widget then talks to the use case’s entry agent.
  • A publishable key whose allowed websites include your site’s origin. Create one in Settings → Developers. See API keys.
  1. Open the agent (or use case) and go to Deploy → Website widget.

  2. Under Chat window design, copy the snippet shown under One line for your website. It looks like this:

    <script src="https://studio.nuacem.dev/widget/nuacemone-widget.js" defer
    data-key="YOUR_PUBLISHABLE_KEY"
    data-agent="AGENT_ID"
    data-gateway="GATEWAY_URL"></script>

    For a use case, the snippet has data-use-case="USE_CASE_ID" instead of data-agent.

  3. Replace YOUR_PUBLISHABLE_KEY with your publishable key. Keep data-gateway exactly as the console shows it.

  4. Paste the snippet just before </body> on every page where the widget should appear.

  5. Open your page. The launcher appears in the corner.

data-key, data-agent (or data-use-case) and data-gateway are required. Without them the widget does not load and logs a warning in the browser console.

The Deploy → Website widget card also offers a separate Chat widget and Call button snippet. These older scripts keep working, but they do not use your Design Studio design. Use the one-line widget for new sites.

Most of the look is set in Design Studio. These attributes override the design on one page, or add behaviour.

Attribute Example What it does
data-position left Puts the launcher on the left.
data-color #125AB0 Brand colour for this page.
data-theme dark Dark window.
data-title Ask us Window title.
data-placeholder Type a message… Hint in the message box.
data-launcher-label Chat with us Text beside the launcher.
data-teaser Questions about your order? A short message beside the launcher.
data-layout page The chat fills the whole page, with no launcher.
data-open true Opens the window when the page loads.
data-attachments false Hides the paperclip button, whatever the agent’s file setting.
Attribute Example What it does
data-language hi The chat’s language.
data-languages en,hi,te Shows a language picker. Switching starts a new chat in that language. The first is the default.
Attribute Example What it does
data-side-panel true Shows the dock icon in the header so visitors can switch between a pop-up and a side panel. false hides the switch.
data-view panel or popup How the window first opens. A visitor’s own later choice wins on their browser.
data-push-page true Narrows your page to make room for the side panel instead of covering it.
Attribute Example What it does
data-prechat name,email Asks for these details before the chat starts. Use name, email, phone, company or your own field names (up to 10).
data-prechat-required name Which fields must be filled in.
data-prechat-intro Tell us about you The line above the form.

The answers are stored with the chat, and the name is used for the contact. Signed-in users (see Signed identity) skip the form.

Attribute Example What it does
data-platform app Inside a mobile app’s WebView, shows the design’s Call us option, which dials a phone number. Websites never show it.

The widget adds a NuacemOneWidget object to your page:

NuacemOneWidget.open();
NuacemOneWidget.close();
NuacemOneWidget.toggle();
NuacemOneWidget.dock(); // switch to the side panel
NuacemOneWidget.undock(); // back to the pop-up
NuacemOneWidget.setView('panel'); // or 'popup'
NuacemOneWidget.getView();
NuacemOneWidget.on('message', (e) => { /* … */ });
// Events: 'message', 'open', 'close', 'call', 'view'

NuacemOneWidget is separate from the NuacemOne client SDK, so both can be on one page.

Design Studio sets how the window looks on your website: colours, fonts, launcher, welcome screen, messages and the call screen.

  1. Go to the agent’s (or use case’s) Deploy → Website widget.
  2. Under Chat window design, choose Open Design Studio.
  3. Start from a theme, or choose Match my website to read your site’s colours and fonts and pick which suggestions to apply.
  4. Work through the sections: Channels, Theme, Identity, Colour, Type, Launcher, Window, Motion, Welcome, Messages, Voice, Typing, Input, Workflow, Phone, Credit, Rules and Language. The preview updates as you go.
  5. Publish the design. Websites pick it up on the next page load, with no change to your script tag.

Until you publish a design, websites show the default NuacemOne look.

  • Window: pop-up, side panel, modal or full screen. Turn on the side-panel switch here to let visitors dock the window.
  • Input: the paperclip, emoji, dictation and voice notes.
  • Voice: the call screen, captions, call button placement and whether the chat or the call opens first.
  • Rules: open the window after a delay, only on some pages, and keep the conversation across pages.

Turn on voice notes in the design’s Input section. Visitors then see a microphone button. They record a note (up to about two minutes), it is turned into text and sent as their message. The recording itself is not kept. Voice notes need a secure (https) page and a browser that can record audio.

Whether the paperclip shows follows the agent’s (or workflow’s, or use case’s) file-sharing setting: always, never, or only after the assistant asks for a file. Accepted files are PDF, Word (.docx), Excel (.xlsx), CSV and text. Each file is scanned before the agent sees it; a blocked file is reported in the chat and never sent. Your organisation’s own limits apply.

Replies can include cards, carousels, lists, tables, buttons, quick replies and slot pickers. The widget draws them and sends a tap as the visitor’s next message. See Rich messages.

For customers who are signed in to your site, you can tell the agent who they are. The agent can then use their record, and the pre-chat form is skipped.

  1. An organisation admin creates the workspace’s identity secret in Settings → Developers. It is shown once; store it on your server.

  2. On your server, compute an HMAC-SHA256 of the user’s id with that secret, as hex.

  3. Add both values to the script tag:

    data-user-id="USER_ID" data-user-hash="USER_HASH"

Never put the identity secret in a web page. Without a valid hash the chat stays anonymous; a wrong hash is refused. See Widget SDK for code samples.

A publishable key only works from the website origins listed on it, for example https://www.example.com. Add each origin that loads the widget, including staging sites. https://example.com and https://www.example.com are different origins.

  • Test pages: on Deploy → Test pages, choose how long the page works (1, 7 or 30 days) and Download test page. You get one HTML file with a demo website and your agent’s chat window (and call button, if web voice is on). It uses the latest saved draft, so it works before you publish. Anyone with the file can use it until it expires or you stop it with Stop all.
  • Hosted page: Deploy → Website widget → Hosted page gives a link to a demo website with your design. Your key’s allowed websites must include the console’s address for it to work.
  • The agent (or the use case’s entry agent) is published, with Web Chat on.
  • The design is published in Design Studio.
  • The publishable key lists every origin that loads the widget.
  • If you use signed identity, the hash is computed on your server and the secret is not in any page.
  • You have stopped test pages you no longer need.

Chats count towards your organisation’s usage. New chats are rate-limited per network, per website and per visitor, and a single chat has a length limit. When a limit is reached the widget shows a message such as “This chat is full. Start a new one.”

Symptom Fix
Nothing appears; the browser console says data-key, data-agent (or data-use-case) and data-gateway are required Add the missing attribute. Copy the snippet from the console again.
“This key cannot be used from this website.” Add your page’s origin to the key’s allowed websites in Settings → Developers.
“The API key is not valid.” The key was revoked, has expired or was mistyped. Create a new publishable key.
“This key cannot be used with this agent.” The key is limited to other agents. Add this agent to the key, or use another key.
“This use case has no entry agent yet.” Set the use case’s entry agent and publish it.
“This assistant is not available right now.” Publish the agent. Websites only reach the live version.
“Web chat is switched off for this assistant.” Turn on Web Chat in the agent’s Channels and publish.
“This assistant takes calls, not chats.” The agent only has voice channels. Turn on Web Chat, or use the call button.
“User verification is not set up for this workspace.” Create the identity secret in Settings → Developers, or remove data-user-id and data-user-hash.
“The user hash does not match the user id.” Compute the hash from exactly the same user id, with the current identity secret, as lowercase hex.
“Too many new chats from this network…” or “This website is starting too many chats…” Wait and try again. If real traffic hits this, ask your NuacemOne contact about limits.
The design does not change on the site Publish the design in Design Studio, then reload the page.
No microphone button for voice notes Turn on voice notes in the design’s Input section, and use an https page.
The window looks unstyled or clashes with the page The widget draws inside its own Shadow DOM, so page CSS cannot reach it. Check you have not loaded two widget scripts.