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

> ## Agent Instructions
> Treat these docs and the Whop MCP server as the source of truth for Whop API behavior. Don't infer endpoint behavior from marketing pages.
> MCP server: connect https://mcp.whop.com/mcp (streamable HTTP, browser sign-in, no API key in the client config) to search these docs and read or change live Whop data. Setup: https://docs.whop.com/developer/guides/ai_and_mcp.md
> Whop CLI: install with `curl -fsSL https://whop.com/install.sh | sh` to scaffold, run, and deploy Whop apps and websites. It acts on production, not the sandbox. Overview: https://docs.whop.com/cli/overview.md Agent mode: https://docs.whop.com/cli/agent-mode.md
> Hosting: Whop serves a site or app from the build `whop apps deploy` uploads, with rollbacks, secrets, and server logs. Guide: https://docs.whop.com/developer/websites/hosting.md
> Plugins: in Claude Code, run `/plugin marketplace add whopio/plugins`, then `/plugin install whop@whop`. Guide: https://docs.whop.com/developer/guides/plugins/claude-code.md Every agent tool: https://docs.whop.com/developer/ai/overview.md
> Environments: build and test in the sandbox (API `https://sandbox-api.whop.com/api/v1`, keys at https://sandbox.whop.com/dashboard/developer, SDK environment `Sandbox`; no real money). Production (API `https://api.whop.com/api/v1`, keys at https://whop.com/dashboard/developer, SDK environment `Production`, the SDK default) moves real money, so use it only at launch. The two share no accounts, keys, products, or webhooks, and their keys look identical: never mix them. Sandbox guide: https://docs.whop.com/developer/guides/sandbox.md Comparison: https://docs.whop.com/developer/quickstart.md
> API: send `Authorization: Bearer <API_KEY>` from your server only, and pin a dated version with the `Api-Version-Date` header. OpenAPI spec: https://api.whop.com/api/v1/openapi.json
> Which API: build on the Current API, whose pages live under https://docs.whop.com/api-reference/ (start at https://docs.whop.com/api-reference/overview.md). Pages under /api-reference/legacy/ are the Legacy API. Use one only when https://docs.whop.com/api-reference/stability.md lists the resource as Legacy-only.

# Chat

> Realtime chat met een kanalenlijst en berichten zoeken.

> [!NOTE]
>
> Deze pagina documenteert `@whop/elements@1.10.0` en `@whop/elements-react@1.10.0`.

*Sinds `v1.10.0`.*

```tsx React theme={null}
import { WhopElements, Chat } from "@whop/elements-react";
import { loadWhop } from "@whop/elements";

function Example() {
  return (
    <WhopElements elements={loadWhop()}>
      <Chat /* options */>
        {/* mount elements here */}
      </Chat>
    </WhopElements>
  );
}
```

```html JavaScript theme={null}
<script src="https://cdn.whop.com/elements/amber/elements.js" data-whop-elements></script>
<script type="module">
  const chat = window.WhopElements().chat.create({ /* options */ });
</script>
```

## Opties

Geef deze door aan `whop.chat.create({ … })`, of als props op `<Chat>` in React.

**accessToken** `string`

Een gebruikerstoken met scopes. Maak er een aan op je server met `POST /api/v1/access_tokens` en stel met `update({ accessToken })` een nieuw token in voordat het verloopt. Kanalen vereisen de scopes `chat:read` en `chat:message:create`, directe berichten `dms:read`, `dms:message:manage` en `dms:channel:manage`, en supportchats `support_chat:read` en `support_chat:message:create`.

**accountId** `string`

Het account-ID waartoe de chat wordt beperkt, met voorvoegsel `biz_`.

**channelId** `string | null`

Het ID van het actieve kanaal, met voorvoegsel `feed_` of `chat_feed_`.

**defaultChannelId** `string | null`

Het ID van het initieel actieve kanaal, met voorvoegsel `feed_` of `chat_feed_`.

**style** `"imessage" | "discord"`

De stijl van de chat. Standaard: `"imessage"`.

**appearance** `Appearance`

Visuele aanpassing voor de elementen van deze groep. Overschrijft de globale `WhopElements({ appearance })`. Wijzig het live met `update({ appearance })`.

**locale** `WhopElementsLocale`

Locale voor de UI-tekst van de elementen in deze groep. Stel deze in op een van de ingebouwde locales van de app om de globale configuratie te overschrijven. Elke andere waarde valt terug op de standaardlocale.

## Events

Geef callbacks door in de create-opties of als React-props.

### `onChannelChange`

Wordt verzonden wanneer het actieve kanaal verandert. Bevat `focusMessageId` wanneer het kanaal opent met een bericht in focus.

**payload** `object`

**properties**

**channelId** `string` *required*

**focusMessageId** `string`

### `onLoadingChange`

Wordt uitgevoerd wanneer de gegroepeerde laadstatus verandert. De waarde is `true` zolang een van de gemounte elementen nog laadt.

**loading** `boolean`

## Methoden

Roep deze aan op de Chat-handle uit `whop.chat.create({ … })` of `useChat()`.

### `update`

Voegt nieuwe handle-opties samen in elk gemount element. Wijzig in React in plaats daarvan de props van de namespace.

**Parameters**

**options** `Partial\<ChatOptions\>` *required*

### `destroy`

Vernietigt elk element en elke sub-controller die deze handle heeft aangemaakt, verwijdert het controllerframe en geeft de abonnementen ervan vrij. Je kunt dit meer dan eens aanroepen, maar een vernietigde handle weigert elke andere aanroep — maak een nieuwe handle aan om opnieuw te beginnen. React verwijdert de groep automatisch wanneer de provider wordt unmount.

## Elementen

De elementen die deze groep mount. Elk element heeft een eigen pagina:

> [card] [ChatElement](https://docs.whop.com/nl/elements/latest/chat/chat.md)
>
> Een realtime berichtenweergave.

> [card] [ChannelListElement](https://docs.whop.com/nl/elements/latest/chat/channelList.md)
>
> Een lijst met de kanalen van de gebruiker.

> [card] [SearchElement](https://docs.whop.com/nl/elements/latest/chat/search.md)
>
> Een modal om berichten te zoeken in alle kanalen van de gebruiker.
