> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ada.cx/chat/web/sdk-api-reference/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ada.cx/_mcp/server.
# SDK API Reference
> **Warning**
>
> Ada has deprecated Chat. Messaging fully replaces Chat on December 15, 2026. Read [Introducing Messaging](https://docs.ada.cx/2026-09-30-introducing-messaging) to learn how to migrate.
This page covers the legacy Chat Web SDK. For Messaging, follow the [script tag migration](/messaging/web/getting-started#migrate-from-the-chat-sdk-web-script) or [npm package migration](/messaging/web/getting-started#migrate-from-the-embed2-npm-package).
Ada's Web Chat consists of a global adaEmbed object that you must [add to your site](/chat/web/getting-started#script-tag) to use any Web SDK functionality, along with corresponding [settings](#settings) and [actions](#actions).
## Settings
Set the Web Chat's configurable options by defining an adaSettings object on your `window` scope.
**`HTML`**
```html HTML
...
```
Alternatively, you can pass settings to the adaEmbed.start method. (See [Delay bot loading](/chat/web/getting-started#delay-bot-loading).)
> **Note**
>
> The Web SDK requires that `window.adaSettings` be defined before the script loads. You must therefore either define `window.adaSettings` before the script, or make use of [async](/chat/web/getting-started#use-async-to-improve-page-load-times) on your web chat script.
The following are all of the available settings for Web chat.
### adaReadyCallback
`adaReadyCallback?(params: { isRolledOut: boolean }): void;`
Specifies a callback function to be called when Web Chat has finished setting up. This is especially useful when Web Chat is loaded asynchronously.
**`HTML`**
```html HTML
```
### allowMetaFieldsInReset
`allowMetaFieldsInReset?: boolean;`
Controls whether a full [`reset({ metaFields })`](#reset) applies caller-supplied meta fields to the new conversation. Defaults to `true`, so reset meta fields apply unless you opt out. Set it to `false` to block them.
Web Chat captures this setting for each `start()` call. Calling `stop()` and then `start()` with different settings can enable reset meta fields again. Page scripts can still supply meta fields through `start()`, `setMetaFields()`, and `setSensitiveMetaFields()`. This setting does not authenticate the script that calls these methods.
A history-preserving reset uses `resetChatHistory: false`. It applies reset meta fields regardless of this setting, because the current end user session survives the reset.
When you opt out, a full `reset()` and `deleteHistory()` restore the meta fields you passed to `start()`. Runtime values that you set with `setMetaFields()` do not carry to the new conversation. This is a deliberate trade-off. Web Chat cannot tell a host-set runtime value from a console-set one, so it restores the `start()` baseline.
By default, `sensitiveMetaFields` apply on a full reset, the same as `metaFields`. When you opt out, the reset drops them without restoring them from the `start()` baseline. The device binding from `setDeviceToken()` survives.
**`HTML`**
```html HTML
```
### chatterTokenCallback
`chatterTokenCallback?(chatter: string): void;`
Specifies a callback for when the `chatter` token has been set in Chat. This is called when chat is first opened by a chatter.
### cluster
`cluster?: string;`
Specifies the Kubernetes cluster your AI Agent runs on.
**Set this only if your Agent is hosted on a non-default cluster** (e.g., `us2`, `maple`, `eu`).
If the Agent is on the default `us` cluster, leave this unset.
For more details, see [Load a bot on a non-default cluster](/chat/web/getting-started#load-a-bot-on-a-non-default-cluster).
> **Info**
>
> Do not change this value unless instructed by your Ada team.
### conversationEndCallback
`conversationEndCallback?(callback: (event?: { [key]: string | object }) => void): void;`
Use `conversationEndCallback` to specify a callback function to be called when a chatter ends the conversation. The callback will receive an event object containing conversation metadata.
**`HTML`**
```html HTML
```
### crossWindowPersistence
`crossWindowPersistence?: boolean;`
When set to `true`, allows the chat drawer open/close state to persist across windows and page refreshes using the `Window.sessionStorage` API. When the browser is closed the state is forgotten. Note that the `crossWindowPersistence` setting only works if an Ada Glass live chat is active (that is, while a chatter is connected to an agent).
> **Note**
>
> We recommend enabling this feature if your bot uses Ada Glass.
### domain
`domain?: string;`
Use this setting to change the subdomain. Unless directed by an Ada team member, you will not need to change this value.
### greeting
`greeting?: string;`
Use to customize the greeting messages that new chatters see. This is useful for setting page-specific greetings across your app. The greeting should correspond to the ID of the Answer you would like to use, which you can find in the URL of the corresponding Answer in the dashboard.
**Example**

> **Note**
>
> This setting is only applicable if you're using a **scripted bot**.
### handle
`handle:? string;`
Can be used to specify the bot handle if one is not specified in the script `data-handle` attribute.
### enableProgrammaticControl
`enableProgrammaticControl?: boolean;`
Opt-in to the transcript-bearing programmatic surface. When set to `true`, your page can:
* Call [`sendMessage`](#sendmessage), [`getMessages`](#getmessages), [`getConversation`](#getconversation), [`setComposerText`](#setcomposertext), and [`setDelegate`](#setdelegate).
* Receive the [`ada:message:sent`](#subscribeevent) and [`ada:message:received`](#subscribeevent) events on host-page subscribers.
While the flag is `false` (the default), those methods reject with `ProgrammaticControlNotEnabled` and the events are not delivered to host subscribers.
> **Warning**
>
> Every script that lives in your host page (analytics tags, GTM, ad pixels, session replay tools, and any third-party SaaS pixel) inherits your page's trust and can subscribe to these events or call these methods. They will see full message bodies, including any PII your chatters type. Have your product and security teams accept that exposure risk explicitly before turning this on.
**`JavaScript`**
```javascript JavaScript
window.adaSettings = {
handle: "",
enableProgrammaticControl: true,
};
```
### headless
`headless?: boolean;`
When set to `true`, Chat connects to the bot in the background without rendering the default chat button or drawer. Use this when your page is rendering its own chat UI and driving the conversation through `sendMessage`, `getMessages`, `getConversation`, and `subscribeEvent`.
Headless sessions are typically paired with [`enableProgrammaticControl: true`](#enableprogrammaticcontrol) — without it the methods needed to drive a custom UI reject at runtime.
Methods that act on the built-in UI are not available in headless mode:
* [`setComposerText`](#setcomposertext) rejects with `HeadlessModeError` — there is no built-in composer to write to.
* [`toggle`](#toggle) is a no-op — there is no drawer to open or close.
* [`isOpen`](#isopen) always returns `false`.
> **Note**
>
> Headless sessions run with no visual indicator. The chatter token is created and persisted to local storage the same way as a visible session. If your page is compromised, an attacker can run chatter activity under the visiting user's token without any user-facing signal — host pages should treat enabling headless as a meaningful trust decision.
**`JavaScript`**
```javascript JavaScript
window.adaSettings = {
handle: "",
headless: true,
enableProgrammaticControl: true,
};
```
### hideMask
`hideMask?: boolean;`
When set to `true`, prevents the default mask from appearing on top of your site's content when opened on desktop.
> **Note**
>
> We recommend setting the value of hideMask to `false`. This allows users to navigate the page while the Ada chat window is open.
### language
`language?: string;`
Set the language for your bot. This setting takes in a language code to programatically set the default bot language. For example, you could change the language to French as in the following example:
**`HTML`**
```html HTML
```
You must first turn languages on in your dashboard:
* If you're using a **generative AI Agent**, go to **Customization** > **Languages**. See [Support multiple languages in the same AI Agent](/docs/setup/languages/about-multilingual-support).
> **Note**
>
> Language codes must use the [ISO 639-1 language format](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
> **Check**
>
> Alternatively, you can use the [setLanguage](#setlanguage) action, which allows you to change the language without clearing the chat history.
### lazy
`lazy?: boolean;`
When set to true `true`, this will prevent the bot from loading until the `adaEmbed.start(...)` method is called. (Alternatively, see [Delay bot loading](/chat/web/getting-started#delay-bot-loading).)
### metaFields
`metaFields?: FlatObject;`
Use metaFields to pass information about a `chatter` to Ada. This can be useful for tracking information about your customers, as well as personalizing their experience. For example, you may wish to track the `phone_number` and `name` for conversation attribution. (See [Variables](https://docs.ada.cx/variables) for more information)
Once set, you can access this information:
* in the email attachment from Handoff Form submissions
* via the **Meta variables** modal in the **Conversations** page of your Ada dashboard
To change these values after bot setup, use the [setMetaFields](#setmetafields) action.
**`HTML`**
```html HTML
```
> **Note**
>
> Meta field keys should not include whitespace, emojis, special characters, or periods.
### onAdaEmbedLoaded
Called when the embed script has been loaded, and before it is initialized. This is useful for [subscribing to events](#subscribeevent). Subscribing here ensures that subscriptions are in place before events are triggered.
**`HTML`**
```html HTML
```
### parentElement
`parentElement?: string | HTMLElement;`
Specifies where to mount the `