Skip to content

Configuration reference

Options are the settings you hand to the widget when it starts. You pass them to init() as one object, which is a group of settings written between curly braces. Only publishableKey or sessionToken is required. Every other option is optional and has a default, so you only list what you want to change.

init({
publishableKey: 'pk_...', // or sessionToken: exactly one, never both
position: 'bottom-right',
color: '#4f46e5',
greeting: 'Hi! How can we help?',
launcherIconUrl: 'https://example.com/icon.png',
emptyStateImageUrl: 'https://example.com/lockup.png',
emptyStateImageAlt: 'Example Co.',
})

Each option below says what it does, then its default. In this list, “set in Aiden” means set in the dashboard on your assistant. A value you pass here always wins over the one set in Aiden.

  • publishableKey: Your public connection key. The widget uses it to start a chat session. You cannot use it together with sessionToken. Default: none. Required unless sessionToken is set.
  • sessionToken: A session token that your own server got from Aiden. It must still be valid when the page starts, unless you also pass getSessionToken. If the token has expired or Aiden refuses it, and no usable replacement can be had, the chat button does not appear. That happens without getSessionToken, when it returns no token that Aiden accepts (or fails, for a token that has already expired), and always when Aiden refuses the token outright (a 403). See Errors. You cannot use it together with publishableKey. Default: none. Required unless publishableKey is set.
  • getSessionToken: Only with sessionToken. A function that gets a fresh session token from your server, the same way you got the first one. It may return the token or a promise of it. The widget calls it only when it needs a new token: when the current one has run out or is about to, or when Aiden refuses it as invalid or expired (a 401). It is not called for a token Aiden refuses outright (a 403), which a new token would not fix. Without it, a chat whose session runs out ends until the page is reloaded. See Use a session token from your own backend. With publishableKey, the widget renews its session by itself, and this option is ignored with a warning. Default: none.
  • language: The language of the widget’s own text, as a language code such as 'fr', 'pt-BR' or 'zh-CN'. See Language options. Default: your page’s <html lang>, otherwise English.
  • messages: Your own wording for any of the widget’s built-in text, in the active language. See Language options. Default: none.
  • contentLanguage: From widget version 0.9.0. The language of the conversation, as a language code such as 'nl' or 'pt-BR': the assistant’s replies, your visitors’ messages, and your greeting, notice, title, subtitle and name. Screen readers use it to pick the voice for that text. Any language works, not only the 11 the widget’s own text comes in. It is separate from language, which sets only the widget’s own text. A value that is not a language code is ignored with a console warning. See Language options. Default: your page’s <html lang>, then language if your page has no lang, otherwise unknown.
  • position: Which corner holds the chat button and chat window: 'bottom-right' or 'bottom-left'. Default: 'bottom-right'.
  • color: The main color, used for the chat button, your visitors’ messages and the Send button. It accepts a hex code such as #4f46e5, a color name such as yellow, or an rgb() or hsl() color. Other formats, such as oklch(), lab(), color-mix(), currentColor and var(...), do not work. See Accessibility. If the widget cannot use your value, it writes a warning in the browser console and uses the color set in Aiden, or the default. Default: the color set in Aiden, otherwise '#4f46e5'.
  • inkColor: The color of the chat title and of the assistant’s replies. It accepts the same formats as color. If the widget cannot use your value, it writes a warning and treats it as not passed. If the color is too pale to read, the widget darkens it automatically. Default: the color set in Aiden, otherwise '#111111'.
  • accentColor: The color of links inside replies. It accepts the same formats as color. An unusable value is handled the same way as for inkColor, and a pale color is darkened automatically. Default: the color set in Aiden, otherwise '#0000ee'.
  • name: The assistant’s name. It shows in the header of the chat window. Screen readers, the software that reads a page aloud for people who cannot see it, announce it as “Chat with {name}”. Default: the name set in Aiden, otherwise 'Aiden'.
  • title: The full title of the chat window. It replaces the whole “Chat with {name}” text, both in the header and in the name that screen readers announce for the window. Use it when you want a heading such as 'Ask our concierge'. Spaces at the start and end are removed, and an empty value is ignored. The assistant’s messages are still labelled with its name for screen readers. Default: “Chat with {name}”.
  • subtitle: From widget version 0.10.0. A second, smaller line under the chat window’s title, such as your property’s name. Screen readers still announce the window by its title alone. Spaces at the start and end are removed, and an empty value is ignored. Default: none.
  • greeting: A welcome message shown in the chat window before the visitor writes anything. Default: none.
  • greetingStyle: From widget version 0.10.0. How greeting is shown. 'bubble' shows it as the assistant’s first message. 'centered' shows it as plain text under emptyStateImageUrl, with the two centered together in the empty chat window. Either way it goes away once the visitor writes. Default: 'bubble'.
  • notice: From widget version 0.9.1. A notice, such as a disclaimer or your terms of use, pinned at the top of the conversation, or under the message box with noticePlacement. Unlike greeting, it stays after the visitor writes. See Notice options. Default: none.
  • requireNoticeAgreement: From widget version 0.9.1. Only with notice. Asks the visitor to select I agree before they can write. See Notice options. Default: false.
  • noticePlacement: From widget version 0.10.0. Where notice is shown: 'top', above the conversation, or 'footer', as small print under the message box. See Notice options. Default: 'top'.
  • launcherIconUrl: The web address of an image to show on the chat button instead of the default chat icon. Only addresses that start with https: or data:image/ work. The default icon shows until your image loads, and for good if it fails to load. It is an alias of theme.launcher.iconUrl. If you pass both, theme.launcher.iconUrl wins. Default: none, so the default icon shows.
  • emptyStateImageUrl: The web address of an image, such as your logo, shown above the greeting while the conversation is empty. The same address rules apply. If the image fails to load, the widget leaves it out. Default: none.
  • emptyStateImageAlt: A short text description of emptyStateImageUrl, for people who cannot see the image. Fill it in when the image carries meaning, such as your brand name. Leave it out if the image is only decoration. Default: none, so the image counts as decoration.
  • showFeedback: Shows thumbs-up and thumbs-down buttons under each reply, so visitors can rate answers. A thumbs-down opens an optional form where the visitor can say what was wrong. Default: false, so the buttons are hidden.
  • zIndex: The widget’s stacking level, which decides what covers what when two things overlap on your page. A higher number sits on top. The default is high enough to sit above sliders, sticky headers and most pop-ups, and still leaves room above it for a cookie or consent dialog. Lower it if one of your own layers should cover the chat. It must be a whole number between -2147483647 and 2147483647. Any other value logs a warning and the default is used. Default: 2147483000.
  • theme: Replaces individual colors, sets the font and text sizes, and chooses the chat button icons. See Theme options. Default: none, so the widget uses its calculated colors, its own font and its default icons.
  • layout: Moves the chat button, resizes it, and sets the preferred size of the chat window. See Layout options. Default: none, so the widget uses its default placement and sizes.
  • apiBaseUrl: The address of the Aiden service the widget talks to. You almost never need to change it. Default: 'https://api.aidenvoice.com'.

The widget’s own text, meaning its buttons, labels, status and error messages, and what screen readers announce, comes in 11 languages: English (en), French (fr), Spanish (es), Portuguese (pt), German (de), Italian (it), Japanese (ja), Simplified Chinese (zh), Russian (ru), Hindi (hi) and Arabic (ar).

  • How the language is chosen. The widget uses the language option if you pass one, then the lang setting on your page’s <html> element, then English. So a French page gets a French widget with no setup. A language value the widget does not support is ignored with a console warning. A page in an unsupported language gets English, with no warning.
  • Regional codes. fr-CA gives French. Any Portuguese code gives Brazilian Portuguese, and any Spanish code gives Latin American Spanish. Simplified Chinese matches zh, zh-CN, zh-SG and zh-Hans. Traditional Chinese, such as zh-TW, zh-HK or zh-Hant, is not supported and gets English.
  • Chosen once, when the widget starts. If your page changes its lang later, the widget does not follow. Pass language instead.
  • Arabic reads right to left. The chat window is mirrored, so the visitor’s messages sit on the left. The corner set by position does not change.
  • Not translated. The assistant’s replies are written by the assistant, in whatever language it answers. Your own greeting, notice, title and name are shown as you write them.
  • The conversation has its own language. From widget version 0.9.0, replies, your visitors’ messages, and your greeting, title and name (and, from 0.9.1, your notice) are marked with the conversation’s language, not the widget’s. That is contentLanguage if you pass it, then your page’s <html lang>, then language if your page has no lang. So on a Dutch page the widget’s buttons are in English, while replies and your Dutch greeting are read with a Dutch voice. Pass contentLanguage when the conversation is in a different language from your page.
  • Upgrading from a version before 0.8.0. If your page’s lang is one of these languages, the widget now shows that language where it showed English before. Pass language: 'en' to keep it in English.

To change the wording, pass messages. Each entry replaces one built-in text in the active language, so write it in that language, or set language to match:

init({
publishableKey: 'pk_...',
language: 'es',
messages: { newConversation: 'Empezar de nuevo' },
})

chatWith and messageSent take {name}, which is replaced by the assistant’s name. An unknown key, or a value that is not a non-empty text, is ignored with a console warning. Text made only of invisible characters, such as spaces or a lone accent mark, counts as empty.

The keys, each with its English text and where it shows:

  • openChat: “Open chat”. Name of the chat button.
  • closeChat: “Close chat”. Chat button while open, and the window’s close button.
  • chatWith: “Chat with {name}”. Window title, unless you set title.
  • newConversation: “New conversation”. Header button.
  • conversation: “Conversation”. Screen-reader name of the message list.
  • you: “You”. Screen-reader label before the visitor’s messages.
  • message: “Message”. Label of the message box.
  • messagePlaceholder: “Type a message…”. From widget version 0.10.0. Hint inside the empty message box. Screen readers still name the box by message.
  • send: “Send”. Send button.
  • messageSent: “Message sent. {name} is preparing a response.” From widget version 0.10.1. Screen-reader announcement when a message is sent. {name} is the assistant’s name.
  • lookingItUp: “Looking that up for you…”. Shown, and from widget version 0.10.1 announced by screen readers, while a slow reply starts.
  • goodResponse: “Good response”. Thumbs-up button.
  • badResponse: “Bad response”. Thumbs-down button.
  • additionalFeedback: “Additional feedback”. Label of the feedback text field.
  • feedbackPlaceholder: “What was wrong? (optional)”. Hint inside the feedback text field.
  • feedbackCategory: “Feedback category”. Label of the reason list.
  • selectReason: “Select a reason (optional)”. First entry of the reason list.
  • categoryFactual: “Factual error”. Reason.
  • categoryIncomplete: “Incomplete”. Reason.
  • categoryTone: “Off tone”. Reason.
  • categoryOther: “Other”. Reason.
  • submit: “Submit”. Feedback form button.
  • cancel: “Cancel”. Feedback form button.
  • feedbackThanks: “Thanks for the feedback”. After feedback is sent.
  • feedbackFailed: “Couldn’t send feedback”. When feedback fails.
  • conversationCleared: “New conversation started. Previous messages were cleared.” Screen-reader announcement after New conversation. Before widget version 0.10.1 the text was “Conversation cleared”.
  • genericError: “Something went wrong, please try again.” Error message in the chat window.
  • sessionExpired: “This chat session has expired. Reload the page to continue.” Error message when the session cannot be renewed.
  • tooManyMessages: “You’re sending messages too quickly. Please wait a moment and try again.” From widget version 0.10.3. Error message when Aiden refuses a message because messages are arriving too fast.
  • assistantUnavailable: “The assistant is unavailable right now. Please try again later.” From widget version 0.10.3. Error message when your assistant has used up its messages for the day.
  • waitForReply: “Please wait for the current reply to finish.” From widget version 0.10.3. Error message when a message is sent while a reply is still arriving.
  • messageLimitReached: “This conversation has reached its message limit. Please try again later.” From widget version 0.10.3. Error message when a conversation is still at its message limit after the widget started a new session.
  • opensInNewTab: “(opens in new tab)”. From widget version 0.9.0. Read by screen readers after each link in a reply, since links open in a new tab. It is not shown on screen.
  • agreeToNotice: “I agree”. From widget version 0.9.1. The button a visitor selects to agree to your notice, with requireNoticeAgreement. If you change it, change your notice’s wording to match.

The translations were drafted by machine and cross-checked, but not reviewed by native speakers. If a text reads wrong to you, replace it with messages, and please tell us.

From widget version 0.9.1, use notice for text every visitor should see before chatting, such as a disclaimer. Add requireNoticeAgreement to have them agree to it first:

init({
publishableKey: 'pk_...',
notice:
'**Welcome to our guest assistant!**\n\nAll information is for informational purposes only. By selecting "I agree", you accept our [Website Terms of Use](https://example.com/terms).',
requireNoticeAgreement: true,
})
  • Where it shows. At the top of the conversation, below emptyStateImageUrl and above greeting, in an outlined box rather than a chat bubble, since the assistant did not say it. It stays there after the visitor writes and after New conversation.
  • As a footer. From widget version 0.10.0, noticePlacement: 'footer' shows the notice as small, centered print under the message box (or under I agree), always in view. It takes at most a quarter of the chat window. A longer notice scrolls inside that space, and keyboard users can reach it with Tab to scroll it. Keep a footer notice to a sentence or two.
  • Formatting. You can use **bold**, _italic_, links written as [text](https://...), and lists with lines that start with - . Links must start with https:. HTML is shown as plain text. An empty notice is ignored.
  • Screen readers read the notice when the chat window opens, until the visitor sends a first message. After that, it is still the first thing in the conversation.
  • With requireNoticeAgreement, an I agree button replaces the message box until the visitor selects it, and nothing can be sent before then. The visitor is asked once per browser tab, and asked again if you change the notice text. Without a notice, the option is ignored with a console warning.
  • Nothing is recorded. The notice and the agreement stay in the visitor’s browser. They are not sent to Aiden, so they are not proof that a visitor agreed. Ask your legal adviser whether that, and your wording, is enough.
  • Keep it short. Screen readers read the whole notice each time the window opens until the visitor writes. Put long legal text behind a link.
  • Write it in your conversation’s language. It is not translated.

color, inkColor and accentColor set your brand colors, and the widget calculates the rest, such as the text on your color, so everything stays readable. The theme option goes further: it replaces any single color, sets the font and text sizes, and chooses the chat button icons. Every key inside theme is optional.

init({
publishableKey: 'pk_...',
theme: {
colors: {
// A dark chat window. Each surface is overridden together with
// the colors drawn on it.
primary: '#0a7d5a',
panel: '#0f172a',
border: '#334155',
headerHover: '#1e293b',
primaryText: '#f1f5f9',
text: '#f8fafc',
focusRing: '#f8fafc',
assistantBubble: '#1e293b',
ink: '#f8fafc',
link: '#7dd3fc',
muted: '#cbd5e1',
},
fonts: {
family: '"Inter", system-ui, sans-serif',
// From widget version 0.10.7. In pixels; leave one out to keep its default.
sizes: { message: 17, title: 18 },
},
launcher: { icon: 'sparkle', openIcon: 'close' },
},
})

theme.colors has 16 optional color roles. A role is the name of one color the widget draws. Give a role a color and the widget uses it exactly as you wrote it. It does not darken it, and it does not fix its contrast. You are responsible for how every color you override looks.

Read Overriding colors with theme.colors before you change a background. Overriding a background does not adjust the text and lines drawn on it. The widget writes a console warning for each one that becomes hard to see, but it does not fix them for you.

Role What it colors, and its built-in default
primary The chat button, your visitors’ messages, and the Send and Submit buttons. Default: #4f46e5.
onPrimary Text and icons on primary. Default: black or white.
primaryText primary used as text on the chat window, in the header controls. Default: a darker primary.
ink The chat title and the assistant’s replies. Default: #111111.
link Links in replies. Default: #0000ee.
text Text in form controls and feedback buttons. Default: #111111.
panel The chat window’s background, and from widget version 0.10.6 the background of the message box and the feedback form’s fields. Default: #ffffff.
border The dividing lines. Default: #e5e5e5.
headerHover The fill behind a header control while it is hovered. Default: #f3f4f6.
assistantBubble The background of the assistant’s replies. Default: #f0f0f0.
muted Secondary text on a reply, and from widget version 0.10.0 the subtitle, a footer notice and the hint in the message box, and from widget version 0.10.6 the hint in the feedback form. Default: #4b5563.
typingDots The dots that show the assistant is writing. Default: #6b7280.
errorBackground The background of the error message. Default: #fee2e2.
errorText The text of the error message. Default: #991b1b.
inputBorder The borders of the message box and the feedback form. Default: #6b7280.
focusRing The dark part of the keyboard focus outline. Default: #111827.

The built-in default is the last choice. The widget chooses each role in this order, from first to last:

  1. The role in theme.colors.
  2. For primary, ink and link, your color, inkColor or accentColor.
  3. For primary, ink and link, the color set in Aiden for your assistant.
  4. The default in the table.

This order is the same whether you use publishableKey or sessionToken. onPrimary is black or white, whichever reads better on primary, and primaryText is primary darkened until it is readable. If you override primary and leave them out, they are recalculated from your new primary.

A color in theme.colors accepts the same formats as color: a hex code, a color name, rgb() or hsl(). Two things differ from color:

  • A usable color is not adjusted. A translucent color, such as rgba(0, 0, 0, 0.5), stays translucent, so the page behind it shows through. color is flattened to a solid color instead.
  • An unusable value is ignored. A typo, currentColor, a var(...) reference or a format the widget does not support leaves the role at its calculated color. The widget writes a warning in the browser console.

If a color you override looks too low in contrast for the surface it is drawn on, the widget writes a warning in the console and still uses your color. When you override a background, it also warns about the text and lines on it that become hard to read, and names the role to override too. It does not change any of them for you. Overriding colors with theme.colors explains what is and is not checked.

theme.fonts.family is a font family list written the way CSS writes it, such as '"Inter", system-ui, sans-serif'. The widget never loads a font. The font must already be available to the visitor’s browser: either a font already installed on the visitor’s device, or one that your own page loads, for example with a Google Fonts link or your own @font-face rule. Name a fallback after it, such as sans-serif, so text still shows if the font is missing.

The widget ignores the value and writes a warning if it is longer than 200 characters, or if it contains url(, @, ;, {, } or a backslash.

From widget version 0.10.7. theme.fonts.sizes sets the size of five groups of text separately, each as a number of pixels. Leave one out to keep its default.

Size What it sizes
message The assistant’s replies, your visitors’ messages, the greeting and a notice at the top. Default: the visitor’s browser default, normally 16. Allowed: 14 to 32.
input The message box and the feedback form’s fields. Default: 16. Allowed: 16 to 32.
title The chat window’s title. Default: 15. Allowed: 12 to 32.
secondary The subtitle, “New conversation”, Send, “I agree”, the error message and the feedback form’s buttons. Default: 13. Allowed: 12 to 32.
small A notice at the bottom and the feedback form’s status text. Default: 12. Allowed: 12 to 32.

A size outside its range is moved to the nearest limit, with a console warning. A value that is not a positive number is ignored, with a console warning. The limits protect your visitors: Text sizes explains them and what we recommend.

theme.launcher changes the icon on the chat button:

  • icon: The built-in icon on the closed chat button: 'chat', 'message' or 'sparkle'. Default: 'chat'.
  • openIcon: The built-in icon on the chat button while the chat window is open: 'chevron-down' or 'close'. Default: 'chevron-down'.
  • iconUrl: The web address of an image to show on the closed chat button instead of the built-in icon. It wins over icon and over the top-level launcherIconUrl. The built-in icon shows until your image loads, and for good if it fails to load.
  • openIconUrl: The web address of an image to show on the open chat button instead of the built-in icon. It wins over openIcon, and the built-in icon shows in the same way until it loads.

iconUrl and openIconUrl follow the image rules in the next section. A value outside those lists is ignored with a console warning, and the default icon stays.

position chooses the corner. layout fine-tunes where the chat button sits and how big the chat button and chat window are. Every value is a number of pixels, and every key is optional.

init({
publishableKey: 'pk_...',
position: 'bottom-right',
layout: {
offset: { x: 24, y: 96 },
launcherSize: 64,
panel: { width: 420, height: 640 },
cornerRadius: 20,
},
})
  • offset: How far the chat button sits from the corner that position chooses, as { x, y }. x is the distance from the left or right edge, and y is the distance from the bottom edge. Each one must be a number of 0 or more. Default: { x: 20, y: 20 }.
  • launcherSize: The width and height of the chat button. A value outside 24 to 120 is moved to the nearest limit, with a console warning. Default: 56.
  • panel: The preferred size of the chat window, as { width, height }. A width below 280 or a height below 320 is raised to that minimum, with a console warning. Default: { width: 360, height: 480 }.
  • cornerRadius: From widget version 0.10.0. How round the corners of the chat window, the message box and the Send and I agree buttons are. About 20 or more turns the message box and Send into pill shapes. A value above 32 is lowered to 32, with a console warning. Default: none, which keeps 12 on the chat window and 6 on the controls.

What the widget does with these values:

  • The chat button never leaves the screen. An offset that would push the button off the screen, or so far from its corner that a chat window of the minimum size no longer fits beside and above it, is held back. When that is already true as the page loads, the widget writes a warning in the console. An offset smaller than 20 is always used as you wrote it.
  • The chat window sits above the chat button. It is placed above the button whatever size and offset you choose.
  • panel is a preferred size. The chat window is always capped to the visitor’s screen. On a screen that is 400 pixels wide or less, or 420 pixels tall or less, the chat window fills the screen instead, as it does by default.
  • A value that is not a number of 0 or more is ignored. The widget writes a warning and uses the default.

A mistake in theme or layout never stops the widget and never makes init() throw. A key the widget does not know, a value of the wrong type, or a value that is not allowed is ignored. The widget writes a warning in the browser console and uses the default. Errors lists the messages, and Troubleshooting helps when an option seems to do nothing.

launcherIconUrl, theme.launcher.iconUrl, theme.launcher.openIconUrl and emptyStateImageUrl accept only addresses that start with https: or data:image/. This is a safety rule. Any other value, such as http:, a relative path, javascript: or data:text/html, is ignored. The widget writes a warning in the browser console and keeps its default look.

Use still images. A moving image that plays for more than five seconds would need a pause button, and the widget does not have one. See Accessibility for more on image descriptions.

When something else already owns the corner

Section titled “When something else already owns the corner”

Some tools that other companies provide, such as accessibility toolbars, chat tools or cookie banners, sit at the highest possible stacking level, 2147483647, in the same corner. No zIndex value can beat that. When two things have the same level, the one added to the page later wins, and those tools are usually added after the widget. The simple fix is to move the widget to the other corner with position: 'bottom-left'.

This part is for developers. resolveTheme is a small helper in the npm package only. It tells you the exact colors the widget will draw for a set of brand colors, using the same calculation the widget runs itself. Use it to preview your branding without showing the widget:

import { resolveTheme } from '@aiden-voice/widget'
const theme = resolveTheme({ color: '#3b82f6', inkColor: '#1f2937', accentColor: '#f97316' })
// theme.primary, theme.textOnPrimary, theme.primaryAsText, theme.ink, theme.link:
// normalized #rrggbb values.
// theme.adjusted.{primary,ink,link}: true only when a supplied, usable color
// was darkened to stay readable. Flattening a translucent color to its
// opaque look over white doesn't count.

resolveTheme also accepts overrides, the same per-role object as theme.colors. It then returns three more fields:

const dark = resolveTheme({ overrides: { panel: '#0f172a', ink: '#f8fafc' } })
// dark.roles: every color the widget draws, by role (all 16 of them).
// dark.overridden: which roles came from overrides.
// dark.contrastWarnings: overridden roles whose contrast against the surface
// they are drawn on is below 4.5:1 (text) or 3:1 (icons, input borders and
// the focus ring). Each entry is { role, against, value, ratio, required }.

Unlike the widget, resolveTheme never writes to the console. Read contrastWarnings instead. It covers the same roles as the console warning, so it does not check the text on a surface you override unless you override that text too.

It needs a browser, or a test environment that imitates one, such as jsdom.

  • Install the widget for the code snippet and npm routes
  • Accessibility for the supported color formats, how the widget keeps text readable, and what to check when you override colors