Skip to main content
This function and all other functions in this graphql sdk are deprecated. Please migrate to the new rest api.
This operation is only available on the server.

Required Permissions

  • experience:attach
  • experience:create

Usage

import { whopSdk } from "@/lib/whop-sdk";

const result = await whopSdk.forums.findOrCreateForum({
	// The ID of the access pass (whop) to attach the experience to. It looks like prod_xxxx.
	accessPassId: "prod_XXXXXXXX",

	// The ID of an existing experience. If supplied, this new forum 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 forum experience to be created, shown to the user on the UI.
	name: "some string" /* Required! */,

	// This is who is allowed to create posts inside the forum. Select 'admin' if you
	// only want the team members to post, or select 'everyone' if any member of the
	// whop can post. Default value is 'admins'.
	whoCanPost: "admins" /* Valid values: admins | everyone */,
});

Example output

const result = {
	// The unique ID representing this experience
	id: "xxxxxxxxxxx",

	// Use this link to directly take users to the experience
	link: "some string",
};