# Embedding the Support Widget The widget adds a chat launcher to any web page. It loads a single script, shows a floating button, and opens the support chat in an iframe. Visitors can keep several requests open and switch between them. [Русский](./embedding.ru-RU.md) | [简体中文](./embedding.zh-CN.md) ## Quick start Replace `https://support.example.com` with the address of your deployment and `YOUR_CHANNEL_ID` with the channel ID from the dashboard. ```html ``` Put both tags before ``. The `AgentDeskConfig` block must run **before** the SDK script. The widget then mounts itself and the launcher appears in the bottom corner. Title, subtitle, theme color, position and width are read from the channel settings in the dashboard, so you normally do not set them in code. ## Configuration | Option | Type | Default | Description | | --- | --- | --- | --- | | `channelId` | `string` | – | **Required.** The channel the widget belongs to. | | `baseUrl` | `string` | script origin | Address of the Agent Desk server. | | `apiBaseUrl` | `string` | `baseUrl` | Use when the API is served from a different origin. | | `widgetBaseUrl` | `string` | script origin | Where the chat page is loaded from. | | `language` | `"zh-CN" \| "en-US"` | server setting | Interface language. Any `en*` value selects English. | | `position` | `"left" \| "right"` | channel setting | Side of the screen for the launcher and window. | | `themeColor` | `string` | channel setting | Accent color, for example `#0f6cbd`. | | `width` | `string` | `380px` | Width of the chat window on desktop. | | `title`, `subtitle` | `string` | channel setting | Header texts. | | `externalId` | `string` | browser-local ID | Stable ID of your own user. | | `signExternalId` | `(id) => {signature, issuedAt}` | – | Proves `externalId` is genuine. See [Identified visitors](#identified-visitors). | | `externalName` | `string` | – | Display name, used when the visitor is first created. | | `getUserToken` | `() => string \| Promise` | – | Returns a JWT issued by your system. | On screens up to 480px wide the chat opens full screen. ## JavaScript API ```js AgentDeskWidget.open() // Promise, opens the chat AgentDeskWidget.close() // minimizes the chat AgentDeskWidget.mount(cfg) // mounts with an explicit config AgentDeskWidget.destroy() // removes launcher and chat AgentDeskWidget.getChatUrl() // Promise, URL for a standalone page or new tab ``` Open the chat from your own button: ```html ``` ## React and Next.js Load the script once on the client. In Next.js (App Router): ```tsx "use client" import Script from "next/script" export function SupportWidget({ channelId }: { channelId: string }) { return ( <>