Fetch a company
import { whopSdk } from "@/lib/whop-sdk";
const result = await whopSdk.companies.listMembers({
// ID of the company, either the tag (biz_xxx) or the page route (whop-dev)
companyId: "biz_XXXXXXXX" /* Required! */,
after: "pageInfo.endCursor",
before: "pageInfo.startCursor",
direction: "asc" /* Valid values: asc | desc */,
first: 10,
last: 10,
order:
"created_at" /* Valid values: created_at | id | joined_at | most_recent_action | usd_total_spent */,
filters: {
// The access pass IDs to filter the members by
accessPassIds: ["xxxxxxxxxxx"],
// The end date to filter the members by
endDate: 1716931200,
// The membership status to filter the members by
membershipStatus:
"active" /* Valid values: active | canceled | completed | drafted | expired | past_due | trialing | unresolved */,
// The most recent actions to filter the members by
mostRecentActions: [
"canceling" /* Valid values: canceling | churned | drafted | expiring | finished_split_pay | joined | left | paid_once | paid_subscriber | past_due | paused | pending_entry | renewing | trialing */,
],
// The plan IDs to filter the members by
planIds: ["xxxxxxxxxxx"],
// The promo code IDs to filter the members by
promoCodeIds: ["xxxxxxxxxxx"],
// The start date to filter the members by
startDate: 1716931200,
// The statuses to filter the members by
statuses: ["drafted" /* Valid values: drafted | joined | left */],
// The tracking link IDs to filter the members by
trackingLinkIds: ["xxxxxxxxxxx"],
},
});
const response = {
// The members for the company
members: {
// The total number of items in this connection.
totalCount: 10,
// Information to aid in pagination.
pageInfo: {
// When paginating backwards, the cursor to continue.
startCursor: "some string",
// When paginating backwards, are there more items?
hasPreviousPage: true,
// When paginating forwards, are there more items?
hasNextPage: true,
// When paginating forwards, the cursor to continue.
endCursor: "some string",
},
// A list of nodes.
nodes: [
{
// The ID of the member
id: "xxxxxxxxxxx",
// When the member was created
createdAt: 1716931200,
// The status of the member
status: "drafted" /* Valid values: drafted | joined | left */,
// The phone number for the member, if available.
phone: "some string",
// The user for this member, if any.
user: {
// The internal ID of the user account.
id: "xxxxxxxxxxx",
// The digital mailing address of the user.
email: "some string",
// The user's full name.
name: "some string",
// The whop username.
username: "some string",
},
// The image for the member, derived from either the User or the Company Buyer.
imageSrcset: {
// Image url with requested image resolution.
original: "some string",
},
},
],
},
};
Was this page helpful?