Skip to main content

Getting Started

A typescript client to interact with the Tribe GraphQL API.

How to use#

Basic Usage#

you can provide graphql url and token as options to the client.

import { TribeClient } from '@tribeplatform/gql-client'
const t = new TribeClient({
graphqlUrl: 'localhost:4000/graphql',
accessToken: '<your-access-token>',
})

or you can set the url in the environment variable TRIBE_GQL_ENDPOINT.

export TRIBE_GQL_ENDPOINT=http://localhost:4000/graphql
const t = new TribeClient({
accessToken?: '<your-access-token>',
})

you can also set the token per request.

const t = new TribeClient({
graphqlUrl?: 'localhost:4000/graphql',
})
t.network.get('basic', accessToken: '<your-access-token>')

App Usage#

To use the client in an app, you need to provide clientId and clientSecret when initializing TribeClient. Then you can use generateToken to generate a token per network by providing networkId to make queries. In case you want to act as a member you can provide memberId to generateToken.

const t = new TribeClient({
graphqlUrl: 'https://app.dev.tribe.so/api/gateway',
clientId: '<your-client-id>',
clientSecret: '<your-client-secret>',
})
t.generateToken({
networkId: '<your-network-id>',
memberId: '<acting-member-id>',
}).then(token => {
// you can set the token globally
t.setToken(token)
// or use it per request
t.network.get('basic', token)
})

Supported Mutations#

archiveMemberSchemaField(key: String!): Network!#

  • βœ… t.network.archiveMemberSchemaField()

updateMemberSchemaField(input: UpdateCustomFieldSchemaInput!): Network!#

  • βœ… t.network.updateMemberSchemaField()

addMemberSchemaField(input: CustomFieldSchemaInput!): Network!#

  • βœ… t.network.addMemberSchemaField()

addReaction(input: AddReactionInput!, postId: ID!): Action!#

  • βœ… t.posts.addReaction()

addSpaceMembers(input: [AddSpaceMemberInput!]!, spaceId: ID!): [SpaceMember!]!#

  • βœ… t.spaceMembers.add()

addTrialPlan(trial: AddTrialInput!): Plan!#

  • ❌

approveSpaceMembershipRequest(): Action!#

  • βœ… t.spaceMembership.approveRequest()

cancelEmailUpdate(id: ID): Action!#

  • βœ… t.members.cancelEmailUpdate()

changeNetworkSubscriptionPlan(name: PlanName!): Network!#

  • ❌

clearNewDomain: Action!#

  • βœ… t.network.clearNewDomain()

clearNotificationsCount: Action!#

  • βœ… t.notifications.clearNotificationsCount()

confirmResetPassword(input: ConfirmResetPasswordInput!): Action!#

  • ❌

createAccessGroup(input: CreateAccessGroupInput!): AccessGroup!#

  • ❌

createCollection(input: CreateCollectionInput!): Collection!#

  • βœ… t.collections.create()

createEmojis(input: [CreateEmojiInput!]!): [Emoji!]!#

  • βœ… t.media.createEmojis()

createImages(input: [CreateImageInput!]!): [SignedUrl!]!#

  • βœ… t.media.createImages()

createMigrationRequest(): ImportRequest!#

  • ❌

createNetwork(input: AddNetworkInput!): AuthTokenWithOtp!#

  • ❌

createPermission(input: CreatePermissionInput!): Permission!#

  • ❌

createPost(input: CreatePostInput!, spaceId: ID!): Post!#

  • βœ… t.posts.create()

createPostTypeTemplate(input: CreatePostTypeTemplateInput!): PostTypeTemplate!#

  • ❌

createReply(input: CreatePostInput!, postId: ID!): Post!#

  • βœ… t.posts.reply()

createReport(input: CreateReportInput!): ModerationItem!#

  • ❌

createSpace(input: CreateSpaceInput!): Space!#

  • βœ… t.spaces.create()

createSpaceType(input: CreateSpaceTypeInput!): SpaceType!#

  • βœ… t.spaces.createType()

createTag(input: CreateTagInput!, spaceId: ID!): Tag!#

  • βœ… t.tags.create()

declineSpaceMembershipRequest(): Action!#

  • βœ… t.spaceMembership.declineRequest()

deleteAccessGroup(id: ID!): Action!#

  • ❌

deleteCollection(id: ID!): Action!#

  • βœ… t.collections.delete()

deleteMember(id: ID!): Action!#

  • βœ… t.members.delete()

deleteNetwork: Action!#

  • ❌

deleteNotification(notificationId: ID!): Action!#

  • βœ… t.notifications.deleteNotification()

deleteNotifications(ids: [ID!]): Action!#

  • βœ… t.notifications.deleteNotifications()

deletePermission(id: ID!): Action!#

  • ❌

deletePost(id: ID!): Action!#

  • βœ… t.posts.delete()

deleteSpace(id: ID!): Action!#

  • βœ… t.spaces.delete()

deleteSpaceType(spaceTypeId: ID!): Action!#

  • ❌

deleteSsoMembership(memberId: String!, type: SsoType!): Action!#

  • ❌

extendCurrentTrial(newEndDate: DateTime!): Plan!#

  • ❌

globalCreateApp(input: CreateAppInput!): App!#

  • ❌

globalCreateWidget(appId: ID!, input: CreateWidgetInput!): Widget!#

  • ❌

globalDeleteAppSetting(): AppSetting!#

  • ❌

globalDeleteWidget(id: ID!): Action!#

  • ❌

globalRegenerateClientSecret(appId: ID!): App!#

  • ❌

globalUpdateApp(id: ID!, input: UpdateAppInput!): App!#

  • ❌

globalUpdateAppSetting(): AppSetting!#

  • ❌

globalUpdateWidget(id: ID!, input: UpdateWidgetInput!): Widget!#

  • ❌

hidePost(id: ID!): Action!#

  • ❌

installApp(appId: ID!, input: InstallAppInput!): AppInstallation!#

  • βœ… t.app.install()

installPostTypeTemplate(input: InstallPostTypeTemplateInput!): PostType!#

  • ❌

inviteMembers(input: InviteMembersInput!): [MemberInvitation!]!#

  • ❌

joinNetwork(input: JoinNetworkInput!): AuthToken!#

  • βœ… t.auth.joinNetwork()

joinNetworkWithInvitationLink(input: JoinNetworkWithLinkInput!): AuthToken!#

  • βœ… t.auth.joinNetworkWithInvitationLink()

joinNetworkWithToken(input: JoinNetworkWithTokenInput!): AuthToken!#

  • βœ… t.auth.joinNetworkWithToken()

joinSpace(spaceId: ID!): Action!#

  • βœ… t.spaces.join()

leaveSpace(spaceId: ID!): Action!#

  • βœ… t.spaces.leave()

organizeCollections(ids: [String!]!): Action!#

  • βœ… t.collections.organize()

organizeSpacesInCollection(): Action!#

  • βœ… t.spaces.organize()

pinPostToSpace(postId: ID!): Action!#

  • βœ… t.posts.pinToSpace()

pinReplyToPost(postId: ID!, replyId: ID!): Action!#

  • ❌

purchase(input: PurchaseInput!): Subscription!#

  • ❌

readNotification(notificationId: ID!): Action!#

  • βœ… t.notifications.readNotification()

readNotifications(ids: [ID!]): Action!#

  • βœ… t.notifications.readNotifications()

removeReaction(postId: ID!, reaction: String!): Action!#

  • βœ… t.posts.removeReaction()

removeSpaceMembers(memberIds: [ID!]!, spaceId: ID!): [Action!]!#

  • βœ… t.spaceMembers.remove()

requestGlobalTokenCode(input: RequestGlobalTokenInput!): Action!#

  • ❌

requestSpaceMembership(spaceId: ID!): SpaceJoinRequest!#

  • βœ… t.spaceMembership.request()

resendGlobalTokenCode(input: RequestGlobalTokenInput!): Action!#

  • ❌

resendVerification: Action!#

  • βœ… t.auth.resendVerification()

sendResetPasswordEmail(email: String!): Action!#

  • βœ… t.auth.sendResetPasswordEmail()

transferToNewDomain: Action!#

  • βœ… t.network.transferToNewDomain()

unhidePost(id: ID!): Action!#

  • ❌

uninstallApp(appInstallationId: ID!, reason: String): AppInstallation#

  • βœ… t.app.uninstall()

unpinPostFromSpace(postId: ID!): Action!#

  • βœ… t.posts.unpinFromSpace()

unpinReplyFromPost(postId: ID!, replyId: ID!): Action!#

  • ❌

unsubscribeFromNotification(input: UnsubscribeWithTokenInput!): Action!#

  • βœ… t.notifications.unsubscribe()

updateAccessGroup(id: ID!, input: UpdateAccessGroupInput!): AccessGroup!#

  • ❌

updateAppInstallation(): AppInstallation!#

  • ❌

updateAppNetworkSettings(appId: ID!, settings: String!): AppAction!#

  • βœ… t.app.updateNetworkSettings()

updateAppSpaceSetting(appId: ID!, settings: String!, spaceId: ID!): AppAction!#

  • ❌

updateBillingDetails(input: BillingDetailsInput!): BillingDetails!#

  • ❌

updateCollection(id: ID!, input: UpdateCollectionInput!): Action!#

  • βœ… t.collections.update()

updateCustomSso(input: UpdateCustomSsoInput!): Sso!#

  • βœ… t.auth.updateCustomSso()

updateDefaultSsoStatus(sso: DefaultSsoType!, status: SsoStatus!): Action!#

  • βœ… t.auth.updateDefaultSsoStatus()

updateImage(id: String!, input: UpdateImageInput!): Image!#

  • ❌

updateMember(id: ID, input: UpdateMemberInput!): Member!#

  • βœ… t.members.update()

updateMemberNetworkNotificationSettings(): MemberNetworkNotificationSettings!#

  • βœ… t.notifications.updateNetworkSettings()

updateMemberSpaceNotificationSettings(): MemberSpaceNotificationSettings!#

  • ❌

updateMemberSpaceRole(): Action!#

  • ❌

updateModerationItem(id: ID!, input: UpdateModerationItemInput!): Action!#

  • βœ… t.moderation.updateItem()

updateModerationSettings(): ModerationSettings!#

  • βœ… t.moderation.updateSettings()

updateNetwork(input: UpdateNetworkInput!): Network!#

  • βœ… t.network.update()

updateNetworkCustomCapacities(): Network!#

  • ❌

updateNetworkStatus(input: UpdateNetworkStatusInput!): Action!#

  • ❌

updateNewDomain(input: UpdateNewDomainInput!): DomainTransferStatus!#

  • βœ… t.network.updateNewDomain()

updatePasswordWithToken(input: UpdatePasswordWithTokenInput!): Action!#

  • ❌

updatePermission(id: ID!, input: UpdatePermissionInput!): Permission!#

  • ❌

updatePost(id: ID!, input: UpdatePostInput!): Post!#

  • βœ… t.posts.update()

updateSpace(id: ID!, input: UpdateSpaceInput!): Space!#

  • βœ… t.spaces.update()

updateSpaceHighlightedTags(): Action!#

  • ❌

updateSpaceTagFilter(input: UpdateTagFilter!, spaceId: ID!): Action!#

  • ❌

updateSpaceType(id: ID!, input: UpdateSpaceTypeInput!): SpaceType!#

  • ❌

updateTag(id: ID!, input: UpdateTagInput!, spaceId: ID!): Tag!#

  • βœ… t.tags.update()

uploadMigrationFiles(): UploadCollectionsResponse!#

  • ❌

upsertTheme(input: UpsertTheme!): NewTheme!#

  • βœ… t.theme.upsert()

verifyMember(input: VerifyMemberInput!): AuthToken!#

  • βœ… t.auth.verifyMember()

verifyMemberEmail(input: VerifyMemberEmailInput!): Action!#

  • ❌

Supported Queries#

accessGroup(id: ID!): AccessGroup!#

  • ❌

accessGroups: [AccessGroup!]!#

  • ❌

app(id: ID, slug: String): App!#

  • βœ… t.app.get()

apps(): PaginatedApp!#

  • βœ… t.app.list()

getNetworkAppInstallations(): PaginatedAppInstallation!#

  • βœ… t.app.appInstallations()

authMember: Member!#

  • ❌

postTypes(): PaginatedPostType!#

  • βœ… t.posts.listPostTypes()

spacePostTypes(): PaginatedSpacePostType!#

  • βœ… t.spacePostType.list()

spacePostType(): SpacePostType!#

  • βœ… t.spacePostType.get()

updateSpacePostTypes(): [SpacePostType!]!#

  • βœ… t.spacePostType.update()

baskets(input: BasketsInput!): [Basket!]!#

  • ❌

billingDetails: BillingDetails!#

  • βœ… t.billing.details()

cancelSubscription: Action!#

  • ❌

collection(id: ID): Collection!#

  • βœ… t.collections.get()

collections(): [Collection!]!#

  • βœ… t.collections.list()

domainAvailability(input: DomainAvailabilityInput!): DomainAvailability!#

  • βœ… t.network.domainAvailability()

emailAvailability(email: String!): EmailAvailability!#

  • ❌

embed(input: EmbedInput!): Embed!#

  • βœ… t.media.embed()

exploreSpaces(): PaginatedSpace!#

  • βœ… t.spaces.explore()

feed(): PaginatedPost!#

  • βœ… t.posts.feed()

getAppNetworkSettings(appId: ID!): String!#

  • βœ… t.app.networkSettings()

getAppSpaceSettings(appId: ID!, spaceId: ID!): String!#

  • βœ… t.app.spaceSettings()

getAppWidget(appId: ID!, widgetId: ID!): Widget!#

  • ❌

getAppWidgets(): PaginatedWidget!#

  • ❌

getMemberAppInstallations(): PaginatedAppInstallation!#

  • ❌

globalApp(id: ID, slug: String): App!#

  • ❌

globalAppSettings(): AppSetting!#

  • ❌

globalAppWidget(appId: ID!, widgetId: ID!): Widget!#

  • ❌

globalAppWidgets(): PaginatedWidget!#

  • ❌

globalApps(): PaginatedApp!#

  • ❌

globalNetworks(): PaginatedNetwork!#

  • ❌

globalToken(input: GlobalTokenInput!): GlobalToken!#

  • ❌

impersonateLoginToNetwork(): AuthInfoWithOtp!#

  • ❌

invitationLinkValidity(id: String!): MemberInvitationLink!#

limitedToken(): AppToken!#

  • βœ… t.getLimitedToken()

loginNetwork(input: LoginNetworkWithPasswordInput!): AuthToken!#

  • βœ… t.auth.login()

loginNetworkWithGlobalToken(): AuthToken!#

  • ❌

loginNetworkWithPassword(input: LoginNetworkWithPasswordInput!): AuthToken!#

  • ❌

loginSupportWithSsoCode(): SupportAuthToken!#

  • ❌

loginWithSsoCode(input: LoginWithSsoCodeInput!): AuthToken!#

  • ❌

media(id: ID!): Media!#

  • ❌

member(id: ID, username: String): Member!#

  • βœ… t.members.get()

memberInvitation(id: ID!): MemberInvitation!#

  • βœ… t.invitations.list()

memberInvitationLink: MemberInvitationLink!#

  • βœ… t.invitations.getLink()

memberInvitationValidity(token: String!): MemberInvitation!#

  • βœ… t.invitations.validate()

memberInvitations(): PaginatedMemberInvitation!#

  • βœ… t.invitations.list()

memberNotificationSettings(id: ID): MemberNotificationSettings!#

  • ❌

memberPosts(): PaginatedPost!#

  • βœ… t.posts.byMember()

memberSpaceMembershipRequest(): [SpaceJoinRequest!]!#

  • βœ… t.spaceMemberships.getMemberRequests()

memberSpaces(): PaginatedSpaceMember!#

  • βœ… t.spaceMembers.listSpaces()

members(): PaginatedMember!#

  • βœ… t.memebrs.list()

moderationItem(id: ID!): ModerationItem!#

  • βœ… t.moderation.getItem()

moderationItemReporters(): PaginatedModerationItemReporter!#

  • βœ… t.moderation.getItemReporters()

moderationItems(): PaginatedModeration!#

  • βœ… t.moderation.getItems()

moderationSettings: ModerationSettings!#

  • βœ… t.moderation.settings()

network: Network!#

  • βœ… t.network.get()

networkApps(status: AppInstallationStatus): [App!]!#

  • ❌

networkPublicInfo: NetworkPublicInfo!#

  • ❌

networks(): PaginatedNetwork!#

  • ❌

networksMembers(): PaginatedPluralMember!#

  • ❌

newDomainStatus(domain: String!): DomainTransferStatus!#

  • βœ… t.network.newDomainStatus()

notifications(after: String, limit: Int!): PaginatedNotification!#

  • βœ… t.notifications.list()

notificationsCount: NotificationsCount!#

  • βœ… t.notifications.count()

passwordComplexity(password: String!): PasswordComplexity!#

  • ❌

permission(id: ID!): Permission!#

  • ❌

permissions: [Permission!]!#

  • ❌

post(id: ID!): Post!#

  • βœ… t.posts.get()

postReactionParticipants(): PaginatedPostReactionParticipant!#

  • βœ… t.posts.reactionParticipants()

postType(id: ID!): PostType!#

  • βœ… t.posts.getPostType()

postTypeTemplates: [PostTypeTemplate!]!#

  • ❌

posts(): PaginatedPost!#

  • βœ… t.posts.list()

redirect(url: String!): Redirect!#

  • ❌

replies(): PaginatedPost!#

  • βœ… t.posts.replies()

report(input: ReportInput!, spaceId: String): Report!#

  • βœ… t.report.get()

roles(orderBy: RoleListOrderByEnum, reverse: Boolean): [Role!]!#

  • βœ… t.roles.list()

scopes(contexts: [PermissionsContextInput!]): Scopes!#

  • ❌

search(input: SearchInput!): SearchResult!#

  • βœ… t.search()

space(id: ID, slug: ID): Space!#

  • βœ… t.spaces.get()

spaceMembers(): PaginatedSpaceMember!#

  • βœ… t.spaceMembers.listMembers()

spaceMembershipRequests(): [SpaceJoinRequest!]!#

  • βœ… t.spaceMembership.getRequests()

spacePinnedPosts(spaceId: ID!): [Post!]!#

  • βœ… t.spaces.pinnedPosts()

spaceRoles(): [SpaceRole!]!#

  • βœ… t.spaceRoles.list()

spaces(): PaginatedSpace!#

  • βœ… t.spaces.list()

ssoMemberships(memberId: String!): [SsoMembership!]!#

  • βœ… t.auth.ssoMemberships()

ssoUrl(input: SsoUrlInput!): SsoUrl!#

  • βœ… t.auth.ssoUrl()

ssos(status: SsoStatus): [Sso!]!#

  • βœ… t.auth.ssos()

subscription(input: subscriptionInput!): Subscription!#

  • ❌

supportNetworkTokens(networkId: String!): SupportLimitedAuthToken!#

  • ❌

supportSsoUrl(input: SupportSsoUrlInput): SupportSsoUrl!#

  • ❌

tagPosts(): PaginatedPost!#

  • ❌

tags(): PaginatedTag!#

  • βœ… t.tags.list()

tokens(): AuthToken!#

  • ❌

usernameAvailability(username: String!): UsernameAvailability!#

  • ❌

vatTypes: [VatTypeInfo!]!#

  • ❌

widget(id: ID!): Slate!#

  • ❌