Skip to main content
This page documents @whop/elements@1.10.0 and @whop/elements-react@1.10.0.
Since v1.10.0.

Options

Pass these to whop.chat.create({ … }), or as props on <Chat> in React.
string
A scoped user token. Create one on your server with POST /api/v1/access_tokens and set a fresh one with update({ accessToken }) before it expires. Channels need the chat:read and chat:message:create scopes, direct messages dms:read, dms:message:manage and dms:channel:manage, and support chats support_chat:read and support_chat:message:create.
string
The account ID to scope chat by, prefixed biz_.
string | null
The active channel ID, prefixed feed_ or chat_feed_.
string | null
The initial active channel ID, prefixed feed_ or chat_feed_.
"imessage" | "discord"
The style of the chat. Defaults to "imessage".
Appearance
Visual customization for this group’s elements. Overrides the global WhopElements({ appearance }). Change it live with update({ appearance }).
WhopElementsLocale
Locale for this group’s element UI text. Set it to one of the app’s built locales to override the global configuration. Any other value falls back to the default locale.

Events

Pass callbacks in the create options or React props.

onChannelChange

Emitted when the active channel changes. Includes focusMessageId when the channel opens with a focused message.
object

onLoadingChange

Runs when the grouped loading state changes. The value is true while any mounted element is still loading.
boolean

Methods

Call these on the Chat handle from whop.chat.create({ … }) or useChat().

update

Merges new handle options into every mounted element. In React, change the namespace props instead. Parameters
Partial<ChatOptions>
required

destroy

Destroys every element and sub-controller this handle created, removes the controller frame, and releases its subscriptions. You can call it more than once, but a destroyed handle refuses any other call — create a new handle to start over. React removes the group automatically when the provider unmounts.

Elements

The elements this group mounts. Each has its own page:

ChatElement

A real-time message view.

ChannelListElement

A list of the user’s channels.

SearchElement

A modal for searching messages across the user’s channels.