> ## Documentation Index
> Fetch the complete documentation index at: https://boundbot.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Embed WebChat

> Embed the BoundBot WebChat widget on your website with iframe or script install options.

export const BrowserWrapper = ({src, alt, title, description, height = '280px', caption, imgStyle = {}, children, imagePadding = '0px'}) => {
  const legacyDocsImagePrefix = '/images/';
  const productionDocsImagePrefix = '/docs/images';
  const rawSrc = typeof src === 'string' ? src : src && (src.src || src.default) || '';
  const imageSrc = rawSrc.startsWith(legacyDocsImagePrefix) ? `${productionDocsImagePrefix}/${rawSrc.slice(legacyDocsImagePrefix.length)}` : rawSrc;
  return <Frame caption={caption || alt || title} width="100%">
      <div style={{
    border: '1px solid #e2e8f0',
    borderRadius: '12px',
    overflow: 'hidden',
    boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
    width: '100%'
  }}>
        <div style={{
    backgroundColor: '#f8fafc',
    padding: '10px 15px',
    borderBottom: '1px solid #e2e8f0',
    display: 'flex',
    gap: '6px'
  }}>
          <div style={{
    width: '10px',
    height: '10px',
    borderRadius: '50%',
    backgroundColor: '#ff5f56'
  }} />
          <div style={{
    width: '10px',
    height: '10px',
    borderRadius: '50%',
    backgroundColor: '#ffbd2e'
  }} />
          <div style={{
    width: '10px',
    height: '10px',
    borderRadius: '50%',
    backgroundColor: '#27c93f'
  }} />
        </div>
        <div style={{
    overflow: 'hidden',
    background: '#ffffff',
    width: '100%',
    padding: imagePadding
  }}>
          {src ? <img src={imageSrc} alt={alt || ''} data-docs-screenshot style={{
    ...imgStyle,
    width: '100%',
    minWidth: '100%',
    height: 'auto',
    display: 'block',
    borderRadius: '0px'
  }} /> : children ? children : null}
        </div>
      </div>
    </Frame>;
};

Use this guide when you want to install the BoundBot WebChat experience on a website you control.

## Before you embed

Make sure you already have:

* a WebChat channel
* a linked bot
* the correct allowed origins
* the website where you want to install the widget

## Step 1: Create a WebChat channel

1. Open <a href="https://www.boundbot.com/dashboard/channels/webchat" target="_blank" rel="noopener noreferrer"><b>Channels</b> -> <b>WebChat</b></a>.
2. Click **Connect WebChat**.
3. Select a bot.
4. Add a display name and optional allowed origins.
5. Save the channel.

<BrowserWrapper src="../images/webchat-connect.png" alt="BoundBot Channels WebChat dashboard showing WebChat channels, public keys, and allowed origins." caption="WebChat channel list and connect flow." />

## Step 2: Customize the widget

1. Open <a href="https://www.boundbot.com/dashboard/settings/general" target="_blank" rel="noopener noreferrer"><b>Settings</b></a> -> <a href="https://www.boundbot.com/dashboard/settings/customize-widget" target="_blank" rel="noopener noreferrer"><b>Customize Widget</b></a> or <a href="https://www.boundbot.com/dashboard/chat-experience/customize" target="_blank" rel="noopener noreferrer"><b>Chat Experience</b> -> <b>Customize</b></a>.
2. Choose the WebChat channel.
3. Set the theme, title, height, position, colors, border radius, and starter suggestions.
4. Save the configuration. The current customization flow can also generate a production iframe snippet for you.

<BrowserWrapper src="../images/customize-widget-dev.png" alt="BoundBot Customize Widget settings with theme, size, position, and starter suggestions for the WebChat widget." caption="Customize Widget page for theme and layout." />

## Step 3: Choose an embed method

### Iframe embed

Use an iframe when you want a direct, predictable installation. This option is intended for tiers that include iframe embed support.

```html theme={null}
<iframe
  allow="microphone"
  style="height: 780px; width: 420px; border: none; display: flex; visibility: visible; position: fixed; right: 0; bottom: 0;"
  title="BoundBot AI Agent"
  src="https://YOUR_WEB_DOMAIN/embed/chat?publicKey=YOUR_PUBLIC_KEY&apiBase=https%3A%2F%2FYOUR_API_DOMAIN&theme=dark&title=BoundBot%20AI%20Agent&position=right&v=1"
></iframe>
```

### Script embed

Use the script when you want a simpler install path managed by the widget runtime. This is the safest default if you want the standard widget install flow.

```html theme={null}
<script
  src="https://YOUR_WEB_DOMAIN/embed/widget.js?publicKey=YOUR_PUBLIC_KEY&apiBase=https%3A%2F%2FYOUR_API_DOMAIN&v=1"
  async
></script>
```

## Validate the install

* Load the site and confirm the widget appears.

<BrowserWrapper src="../images/inbox-chat.png" alt="BoundBot Inbox showing a conversation thread from the WebChat widget." caption="Verify the conversation in Inbox after testing the widget." />

* Send a test message and confirm the bot replies.
* Open <a href="https://www.boundbot.com/dashboard/inbox" target="_blank" rel="noopener noreferrer"><b>Inbox</b></a> and verify the conversation was recorded.
* Confirm the origin is allowed if you restricted the channel.

## Current widget behavior

* **First message before the conversation is ready**: users can type from the starter screen before the widget finishes creating the conversation. BoundBot sends that first message automatically once the session is ready, so the opening question is not lost.
* **Muted conversations**: if the conversation is muted for human handoff, WebChat skips the AI reply until auto reply is turned back on. This is the same mute state used by the <a href="/automation/actions">Stop Auto Reply</a> action.

<Note>
  The current customization page focuses on live preview, saved UI settings, and production iframe code generation. The actual install still depends on your WebChat public key and the embed patterns shown here.
</Note>

## Troubleshooting

**Iframe does not load**

* Check the `/embed/chat` host.
* Check the `publicKey`.
* Check `NEXT_PUBLIC_WEB_BASE_URL` and `NEXT_PUBLIC_API_BASE_URL`.

**Origin not allowed**

* Add the exact origin to the channel configuration, including protocol.

**No streaming reply**

* Make sure the API streaming route is reachable.
* If you use a reverse proxy, confirm it does not buffer server-sent events.

<Tip>
  WebChat is the easiest place to test a new bot before you roll it out to social or team messaging channels.
</Tip>

## Related pages

<CardGroup cols={2}>
  <Card title="WebChat" icon="message-square" href="/channels/webchat">
    Create the channel, set allowed origins, and manage the public key before you embed.
  </Card>

  <Card title="Playground" icon="flask-conical" href="/guides/playground">
    Test the same live WebChat pipeline before you install it on a production site.
  </Card>

  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Follow the fastest route from signup to a working website chat bot.
  </Card>

  <Card title="WordPress plugin" icon="blocks" href="/developers/wordpress-plugin">
    Use the plugin when you would rather not paste embed code manually.
  </Card>
</CardGroup>
