This operation is only available on the server.
Required Permissions
experience:attach
experience:create
Usage
Copy
Ask AI
import { whopSdk } from "@/lib/whop-sdk";
const result = await whopSdk.messages.findOrCreateChat({
// The ID of the access pass (whop) to attach the chat experience to. It looks like prod_xxxx.
accessPassId: "prod_XXXXXXXX",
// The ID of an existing experience. If supplied, this new chat experience will
// be attached to the first access pass (whop) of this experience. It looks like exp_xxxx.
experienceId: "exp_XXXXXXXX",
// The name of the chat experience to be created, shown to users in the UI.
name: "some string" /* Required! */,
// This is who is allowed to send messages inside the chat. Select 'admin' if you
// only want the team members to message, or select 'everyone' if any member of
// the whop can send messages.
whoCanPost: "admins" /* Valid values: admins | everyone */,
});
Example output
Copy
Ask AI
const result = {
// The unique ID representing this experience
id: "xxxxxxxxxxx",
// Use this link to directly take users to the experience
link: "some string",
};