> ## 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.

# 채팅

> 채널 목록과 메시지 검색을 갖춘 실시간 채팅.

> [!NOTE]
>
> 이 페이지는 `@whop/elements@1.10.0` 및 `@whop/elements-react@1.10.0`을 다룹니다.

*`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>
```

## 옵션

`whop.chat.create({ … })`에 전달하거나, React에서는 `<Chat>`의 props로 전달하세요.

**accessToken** `string`

범위가 지정된 사용자 토큰입니다. 서버에서 `POST /api/v1/access_tokens`로 만들고, 만료되기 전에 `update({ accessToken })`로 새 토큰을 설정하세요. 채널에는 `chat:read` 및 `chat:message:create` 스코프가, 다이렉트 메시지에는 `dms:read`, `dms:message:manage`, `dms:channel:manage`가, 지원 채팅에는 `support_chat:read` 및 `support_chat:message:create`가 필요합니다.

**accountId** `string`

채팅 범위를 지정할 `biz_` 접두사가 붙은 계정 ID입니다.

**channelId** `string | null`

`feed_` 또는 `chat_feed_` 접두사가 붙은 활성 채널 ID입니다.

**defaultChannelId** `string | null`

`feed_` 또는 `chat_feed_` 접두사가 붙은 초기 활성 채널 ID입니다.

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

채팅의 스타일입니다. 기본값은 `"imessage"`입니다.

**appearance** `Appearance`

이 그룹 엘리먼트의 시각적 사용자 지정입니다. 전역 `WhopElements({ appearance })`를 재정의합니다. `update({ appearance })`로 실시간 변경할 수 있습니다.

**locale** `WhopElementsLocale`

이 그룹 엘리먼트 UI 텍스트의 로케일입니다. 앱에 빌드된 로케일 중 하나로 설정하면 전역 구성을 재정의합니다. 그 외의 값은 기본 로케일로 대체됩니다.

## 이벤트

콜백은 create 옵션 또는 React props로 전달하세요.

### `onChannelChange`

활성 채널이 변경될 때 발생합니다. 채널이 포커스된 메시지와 함께 열리면 `focusMessageId`가 포함됩니다.

**payload** `object`

**properties**

**channelId** `string` *required*

**focusMessageId** `string`

### `onLoadingChange`

그룹 로딩 상태가 바뀔 때 실행됩니다. 마운트된 엘리먼트 중 하나라도 로딩 중이면 값은 `true`입니다.

**loading** `boolean`

## 메서드

`whop.chat.create({ … })` 또는 `useChat()`으로 얻은 Chat 핸들에서 호출하세요.

### `update`

마운트된 모든 엘리먼트에 새 핸들 옵션을 병합합니다. React에서는 대신 네임스페이스 props를 변경하세요.

**매개변수**

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

### `destroy`

이 핸들이 만든 모든 엘리먼트와 하위 컨트롤러를 파괴하고, 컨트롤러 프레임을 제거하고, 구독을 해제합니다. 여러 번 호출할 수 있지만, 파괴된 핸들은 다른 모든 호출을 거부합니다. 다시 시작하려면 새 핸들을 만드세요. React는 프로바이더가 언마운트될 때 그룹을 자동으로 제거합니다.

## 엘리먼트

이 그룹이 마운트하는 엘리먼트입니다. 각 엘리먼트에는 자체 페이지가 있습니다.

> [card] [ChatElement](https://docs.whop.com/ko/elements/latest/chat/chat.md)
>
> 실시간 메시지 보기입니다.

> [card] [ChannelListElement](https://docs.whop.com/ko/elements/latest/chat/channelList.md)
>
> 사용자의 채널 목록입니다.

> [card] [SearchElement](https://docs.whop.com/ko/elements/latest/chat/search.md)
>
> 사용자의 채널 전체에서 메시지를 검색하는 모달입니다.


## Related topics

- [지원 채팅](https://docs.whop.com/ko/developer/guides/chat/support-chats.md)
- [채팅 인증](https://docs.whop.com/ko/developer/guides/chat/authentication.md)
- [채팅 OAuth](https://docs.whop.com/ko/developer/guides/chat/oauth.md)
