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

# Sohbet Hızlı Başlangıcı

> Bir API anahtarı oluşturmaktan ilk konuşmanızı görüntülemeye kadar Whop sohbetini web veya iOS uygulamanıza ekleyin.

[Whop sohbetini uygulamanıza gömün](https://www.youtube.com/embed/MqgyFg9YyCw?rel=0)

1
Bir API anahtarı oluşturun

[Whop Geliştirici Kontrol Paneli](https://whop.com/dashboard/developer) üzerinden bir API anahtarı oluşturun ve sunucunuzda `WHOP_API_KEY` olarak kaydedin.

Bu anahtar, hesabınızın bağlamında işlem yapmanızı sağlar. Onu sunucuda tutun. Asla tarayıcı, mobil veya istemci tarafı koduna koymayın.

2
Paketleri kurun

SDK'yı arka ucunuza kurun:

> [tab] Next.js
>
> ```bash theme={null}
> pnpm add @whop/sdk
> ```

> [tab] Express
>
> ```bash theme={null}
> pnpm add @whop/sdk
> ```

> [tab] cURL
>
> İstekleri kendiniz yapmayı tercih ediyorsanız [API referansına](https://docs.whop.com/tr/developer/quickstart.md) da göz atabilirsiniz.

Elements paketlerini ön ucunuza kurun:

> [tab] React
>
> ```bash theme={null}
> pnpm add @whop/embedded-components-react-js @whop/embedded-components-vanilla-js
> ```

> [tab] HTML
>
> ```html theme={null}
> <script src="https://apollo.elements.whop.com/release/elements.js"></script>
> ```

> [tab] iOS
>
> Xcode'da bu Swift paketini ekleyin:
>
> ```text theme={null}
> https://github.com/whopio/whopsdk-elements-swift
> ```
>
> Sohbet fotoğrafları, videoları ve sesli mesajları destekler, bu nedenle uygulamanızın `Info.plist` dosyasına şu izinleri ekleyin:
>
> ```xml Info.plist theme={null}
> <key>NSCameraUsageDescription</key>
> <string>Allow camera access to take photos and videos in chat</string>
> <key>NSMicrophoneUsageDescription</key>
> <string>Allow microphone access to record voice messages in chat</string>
> <key>NSPhotoLibraryUsageDescription</key>
> <string>Allow photo library access to share photos and videos in chat</string>
> ```

Web paketlerinin dışa aktardığı her sınıf, seçenek ve tür [paket referansında](https://docs.whop.com/tr/sdk/elements/overview.md) listelenmiştir.

3
Kullanıcılarınız için bir kullanıcı kimliği alın

Sohbet token'ları oluşturmadan önce kendi kullanıcılarınızı alt hesap olarak kaydedin. Bu, platformunuzdaki kullanıcıyla eşleyebileceğiniz bir Whop hesabı oluşturur.

> [tab] Next.js
>
> ```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
> });
> ```

> [tab] Express
>
> ```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
> });
> ```

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST https://api.whop.com/api/v1/accounts \
>   -H "Authorization: Bearer $WHOP_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "email": "user@example.com",
>     "title": "Jane Doe",
>     "external_id": "user_12345"
>   }'
> ```

Ortaya çıkan Whop kullanıcı kimliğini (yanıttaki `owner_user.id`) kendi tarafınızda kaydedin ve sohbet erişim token'ları oluştururken `user_id` olarak iletin.

Kullanıcıların avatarlarını ve görünen adlarını nasıl güncelleyeceğinize dair daha fazla ayrıntı için [hesaba özel profillere](https://docs.whop.com/tr/developer/guides/chat/sync-users.md#2-set-an-account-specific-name-and-profile-picture) bakın.

4
Sunucunuzda bir token uç noktası oluşturun

API anahtarınızla `POST https://api.whop.com/api/v1/access_tokens` çağrısı yapan ve ortaya çıkan token'ı istemciye döndüren bir uç nokta ekleyin.

> [tab] Next.js
>
> ```typescript app/api/chat/token/route.ts theme={null}
> import { NextResponse } from "next/server";
> import { WhopClient } from "@whop/sdk";
>
> const client = new WhopClient({ token: process.env.WHOP_API_KEY });
>
> export async function POST() {
>   // Derive these from your own auth / session in production.
>   const user_id = "user_XXXXXXXXXXXX";
>   const account_id = "biz_XXXXXXXXXXXXX";
>
>   const { token } = await client.accessTokens.create({
>     account_id,
>     user_id,
>     scoped_actions: [
>       "chat:message:create",
>       "chat:read",
>       "dms:read",
>       "dms:message:manage",
>       "dms:channel:manage",
>       "support_chat:read",
>       "support_chat:message:create",
>     ],
>   });
>
>   return NextResponse.json({ token });
> }
> ```

> [tab] Express
>
> ```typescript server.ts theme={null}
> import express from "express";
> import { WhopClient } from "@whop/sdk";
>
> const app = express();
> app.use(express.json());
>
> const client = new WhopClient({ token: process.env.WHOP_API_KEY });
>
> app.post("/api/chat/token", async (_req, res) => {
>   // Derive these from your own auth / session in production.
>   const user_id = "user_XXXXXXXXXXXX";
>   const account_id = "biz_XXXXXXXXXXXXX";
>
>   const { token } = await client.accessTokens.create({
>     account_id,
>     user_id,
>     scoped_actions: [
>       "chat:message:create",
>       "chat:read",
>       "dms:read",
>       "dms:message:manage",
>       "dms:channel:manage",
>       "support_chat:read",
>       "support_chat:message:create",
>     ],
>   });
>
>   res.json({ token });
> });
>
> app.listen(3000);
> ```

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST https://api.whop.com/api/v1/access_tokens \
>   -H "Authorization: Bearer $WHOP_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "account_id": "biz_XXXXXXXXXXXXX",
>     "user_id": "user_XXXXXXXXXXXX",
>     "scoped_actions": [
>       "chat:message:create",
>       "chat:read",
>       "dms:read",
>       "dms:message:manage",
>       "dms:channel:manage",
>       "support_chat:read",
>       "support_chat:message:create"
>     ]
>   }'
> ```

5
Bir kanal, DM veya destek sohbeti oluşturun ya da getirin

Tüm sohbet türleri gerçek zamanlı mesajlaşma kullanır ve Chat öğesinde görüntülenebilir. Türü ihtiyaçlarınıza göre seçin:

> [card] [Kanallar](https://docs.whop.com/tr/developer/guides/chat/channels.md)
>
> Herkese açık veya büyük grup konuşmaları için ortak bir sohbet. Denetim, salt okunur seçenekler sunan ve sabit bir üye sınırı olmayan odalar.

> [card] [Doğrudan mesajlar](https://docs.whop.com/tr/developer/guides/chat/direct-messages.md)
>
> Kullanıcılar arasında özel bir konuşma. DM listesinde görünürler ve en fazla 50 üye içerebilirler.

> [card] [Destek sohbeti](https://docs.whop.com/tr/developer/guides/chat/support-chats.md)
>
> Bir kullanıcı ile hesabınız arasında bire bir destek konuşması. Müşteriler bunları DM'ler gibi görür. Yöneticiler bunları DM listesi yerine bir destek gelen kutusu üzerinden yönetir.

Sohbeti görüntülemeden önce açmak istediğiniz kanal kimliğini alın.

* [**Kanal**](https://docs.whop.com/tr/developer/guides/chat/channels.md) kimlikleri `chat_feed_` ile başlar.
* [**DM**](https://docs.whop.com/tr/developer/guides/chat/direct-messages.md) ve [**destek sohbeti**](https://docs.whop.com/tr/developer/guides/chat/support-chats.md) kimlikleri `feed_` ile başlar.

6
Sohbeti uygulamanızda görüntüleyin

Bu, bir token almak ve chat öğesini görüntülemek için oluşturduğunuz token uç noktasını kullanır. Token'ı yönetmek ve gerektiğinde yenilemek SDK'nın sorumluluğundadır.

> [tab] React
>
> ```tsx theme={null}
> "use client";
>
> import {
>   ChatElement,
>   ChatSession,
>   Elements,
> } from "@whop/embedded-components-react-js";
> import { loadWhopElements } from "@whop/embedded-components-vanilla-js";
>
> const elements = loadWhopElements();
>
> async function getToken() {
>   const res = await fetch("https://your-server.com/api/chat/token", { method: "POST" });
>   const data = await res.json();
>   return data.token;
> }
>
> export function Chat() {
>   return (
>     <Elements elements={elements}>
>       <ChatSession token={getToken}>
>         <ChatElement
>           options={{ channelId: "chat_feed_XXXXXXXXXXXXXX" }}
>           style={{ height: "100dvh", width: "100%" }}
>         />
>       </ChatSession>
>     </Elements>
>   );
> }
> ```

> [tab] HTML
>
> ```html theme={null}
> <div id="chat" style="height: 100vh"></div>
>
> <script>
>   const elements = new WhopElements();
>
>   async function getToken() {
>     const res = await fetch("https://your-server.com/api/chat/token", { method: "POST" });
>     const data = await res.json();
>     return data.token;
>   }
>
>   const session = elements.createChatSession({ token: getToken });
>   const chat = session.createElement("chat-element", {
>     channelId: "chat_feed_XXXXXXXXXXXXXX",
>   });
>
>   chat.mount("#chat");
> </script>
> ```

> [tab] iOS
>
> ```swift theme={null}
> import SwiftUI
> import WhopElements
>
> struct ContentView: View {
>   var body: some View {
>     WhopChatView(
>       channelId: "chat_feed_XXXXXXXXXXXXXX",
>       style: .imessage
>     )
>     // This should be done as soon as you know your user is authenticated so its
>     // prepared and ready to use without delays.
>     .task {
>       await WhopSDK.configure(tokenProvider: WhopAPITokenProvider())
>     }
>   }
> }
>
> class WhopAPITokenProvider: WhopTokenProvider {
>   func getToken() async -> WhopTokenResponse {
>     let url = URL(string: "https://your-server.com/api/chat/token")!
>     var request = URLRequest(url: url)
>     request.httpMethod = "POST"
>
>     do {
>       let (data, _) = try await URLSession.shared.data(for: request)
>       let json = try JSONSerialization.jsonObject(with: data) as! [String: Any]
>       return WhopTokenResponse(accessToken: json["token"] as? String ?? "")
>     } catch {
>       return WhopTokenResponse(accessToken: "")
>     }
>   }
> }
> ```

## Sonraki adımlar

> [card] [Kimlik doğrulama](https://docs.whop.com/tr/developer/guides/chat/authentication.md)
>
> Gömülü sohbet için hesap kapsamlı token'lar ile OAuth arasında seçim yapın.

> [card] [Kullanıcılarınızı senkronize edin](https://docs.whop.com/tr/developer/guides/chat/sync-users.md)
>
> Hesap kapsamlı sohbet token'ları oluşturmadan önce Whop kullanıcılarını oluşturun veya eşleyin.

> [card] [Chat öğesi](https://docs.whop.com/tr/developer/guides/chat/chat-element.md)
>
> Sohbet arayüzünün prop'larını, olaylarını, stillerini ve derin bağlantı seçeneklerini öğrenin.

> [card] [DM listesi öğesi](https://docs.whop.com/tr/developer/guides/chat/dms-list-element.md)
>
> Bir kullanıcının doğrudan mesaj konuşmalarının listesini gösterin.
