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

# Update Webchat configuration

You can update your [Webchat's configuration](https://botpress.com/docs/webchat/get-started/configure-your-webchat.md) dynamically using JavaScript. This is useful if you want to update Webchat's style or settings after it's already loaded on your website.

> [!NOTE]
>
> You will need:
>
> * A website with an [embedded bot](https://botpress.com/docs/webchat/get-started/quick-start.md)
> * Familiarity with JavaScript

## Update configuration

To update Webchat's configuration, you can call the [`window.botpress.config`](https://botpress.com/docs/webchat/interact/reference#config) method after Webchat has been initialized:

```js theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
window.botpress.config(
  {
    configuration: {},
  }
);
```

Include any [`configuration`](https://botpress.com/docs/webchat/interact/reference#param-configuration) object you'd like to apply the new configuration.

> [!TIP]
>
> You don't need to provide the entire `configuration` object every time—just the values that you want to update. Any fields you don't include will default to the most recent configuration.

## Switch to dark theme

Here's an example that updates Webchat's theme to dark mode as soon as Webchat loads:

```js theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
const webchatConfig = {
    "themeMode": "dark",
};

window.botpress.on('webchat:initialized', () => {
    window.botpress.config({ configuration: webchatConfig });
});
```

The above snippet:

1. Waits until [Webchat is initialized](https://botpress.com/docs/webchat/interact/listen-to-events.md#webchat-is-initalized)
2. Updates the [`themeMode`](https://botpress.com/docs/webchat/interact/reference#param-theme-mode) configuration to `dark`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.