Skip to main content
1

Create an API key

Create an API key in the Whop Developer Dashboard and save it on your server as WHOP_API_KEY. This key will allow you to perform actions within the context of your company. Keep it on the server. Never put it in browser, mobile, or client-side code.
2

Install packages

Install the SDK in your backend:
Install the elements packages in your frontend:
3

Get a user ID for your users

Enroll your own users as connected accounts before minting chat tokens. This creates a Whop account you can map back to your platform user.
Save the resulting Whop user ID (owner_user.id in the response) on your side and pass it as user_id when you create chat access tokens. See company-specific profiles for more details on how to update users avatars and display names.
4

Create a token endpoint on your server

Add an endpoint that calls POST https://api.whop.com/api/v1/access_tokens with your API key and returns the resulting token to the client.
app/api/chat/token/route.ts
5

Create or fetch a channel, DM, or support chat

All chat types use real-time messaging and can render in the Chat element. Pick the type based on your needs:

Channels

A shared chat for public or large group conversations. Rooms with moderation, read-only options, and no fixed member cap.

Direct messages

A private conversation between users. They show in the DMs list and can include up to 50 members.

Support chat

A one-on-one support conversation between a user and your company. Customers see them like DMs; admins manage them through a support inbox instead of the DMs list.
Before rendering chat, get the channel ID you want to open.
6

Render chat in your app

This will use the token endpoint you created to fetch a token and render the chat element. The SDK is responsible of managing the token and refreshing it when necessary.

Next steps

Authentication

Choose between company-scoped tokens and OAuth for embedded chat.

Sync your users

Create or map Whop users before minting company-scoped chat tokens.

Chat element

Learn the props, events, styles, and deeplinking options for the chat UI.

DMs list element

Show a list of a user’s direct message conversations.