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

# 임베디드 채팅에 사용자 동기화하기

> 채팅 토큰을 발급하기 전에 플랫폼 사용자를 하위 계정으로 등록한 다음, Update user로 계정별 이름과 프로필 사진을 설정하세요.

임베디드 채팅용 계정 범위 사용자 토큰을 발급하기 전에 사용자를 동기화하세요. `user_id`로 전달하는 사용자는 Whop에 존재해야 하며, 채팅에서 해당 사용자에게 표시되는 계정별 이름과 프로필 사진을 제공할 수 있습니다.

> [!NOTE]
>
> 이 작업은 **OAuth에서는 필요하지 않습니다**. OAuth를 사용하면 사용자가 Whop에 로그인하고 OAuth 토큰이 사용자의 Whop 계정을 식별합니다.

## 사용자를 하위 계정으로 등록하기

플랫폼의 각 사용자에 대해 하위 계정을 생성하세요. 이는 [지급 SDK](https://docs.whop.com/ko/developer/platforms/render-payout-portal.md)에서 사용하는 것과 같은 흐름입니다. 전체 안내는 [하위 계정 등록하기](https://docs.whop.com/ko/developer/platforms/enroll-subaccounts.md) 가이드를 참고하세요.

```typescript theme={null}
import { WhopClient } from "@whop/sdk";

const client = new WhopClient({ token: process.env.WHOP_API_KEY });

const account = await client.accounts.create({
  email: "user@example.com",
  title: "Jane Doe",
  external_id: "user_12345", // your platform's user ID
});
```

결과로 받은 사용자 ID를 저장해 두세요. 계정 범위 채팅 토큰을 발급할 때 전달합니다.

## 계정별 이름과 프로필 사진 설정하기

계정 ID와 함께 [Update user](https://docs.whop.com/ko/api-reference/users/update-user.md) 엔드포인트를 호출하여 내 계정 컨텍스트에서 해당 사용자에게 표시되는 재정의 값을 정의하세요. 계정 ID가 없으면 필드는 대신 사용자의 전역 프로필을 업데이트합니다.

[Create file](https://docs.whop.com/ko/api-reference/files/create-file.md) 엔드포인트로 아바타를 업로드한 다음, 반환된 파일 ID를 프로필 사진으로 전달하세요.

플랫폼에서 사용자의 프로필이 변경될 때마다 이를 호출하여 Whop과 동기화 상태를 유지하세요.

> [!NOTE]
>
> Update user 엔드포인트를 사용하려면 요청하는 API 키에 `user:profile:update` 권한이 있어야 합니다. **소유자 수준** 접근 권한이 있는 계정 API 키나 `user:profile:update` 범위가 포함된 키를 사용하세요.

## 다음 단계

> [card] [인증](https://docs.whop.com/ko/developer/guides/chat/authentication.md)
>
> 임베디드 채팅용 계정 범위 사용자 토큰을 발급합니다.

> [card] [OAuth](https://docs.whop.com/ko/developer/guides/chat/oauth.md)
>
> 사용자를 직접 동기화하는 대신 Whop 로그인을 사용합니다.

> [card] [Chat 요소](https://docs.whop.com/ko/developer/guides/chat/chat-element.md)
>
> 사용자가 인증되면 실시간 채팅 UI를 렌더링합니다.

> [card] [하위 계정 등록하기](https://docs.whop.com/ko/developer/platforms/enroll-subaccounts.md)
>
> 전체 하위 계정 등록 흐름을 알아봅니다.


## Related topics

- [임베디드 채팅 다이렉트 메시지](https://docs.whop.com/ko/developer/guides/chat/direct-messages.md)
- [채팅 빠른 시작](https://docs.whop.com/ko/developer/guides/chat/quickstart.md)
- [임베디드 채팅 채널](https://docs.whop.com/ko/developer/guides/chat/channels.md)
