Docs / data / claimRoomInvites

claimRoomInvites

utilitysince 0.6.0

Client function: claim every pending invite addressed to the caller's verified email.

import { claimRoomInvites } from 'flowstack-sdk'

Non-React client function. POST /rooms/claim. The second half of the email-invite flow: inviteRoomMember writes a pending grant, this converts every grant matching the caller's verified email into real membership. Returns the room ids joined.

Signature

claimRoomInvites(credentials, config?): Promise<ApiResponse<{ rooms: string[] }>>

Parameters

ParamTypeNotesDescription
credentialsFlowstackCredentialsrequiredThe signing-in user's credentials.
configFlowstackClientConfigClient config. appScope is required — the function throws without it.

Returns

FieldTypeDescription
Promise<ApiResponse<{ rooms: string[] }>>The room ids just joined. Empty array when there were no pending invites.

Examples

Claim after sign-in
// Run once after authentication resolves:
const res = await claimRoomInvites(credentials, { appScope });
if (res.ok && res.data.rooms.length) {
  // newly joined rooms — refresh whatever lists them
}
WarningRequires an appScope on the FlowstackProvider config — the SDK throws Rooms require an app scope (built-app context). before any network call if it is missing. The ACL is enforced server-side: the SDK never decides membership, so a client-side membership check is decoration, not security.
WarningNothing claims invites implicitly. An app that never calls this leaves every email-invited user permanently locked out of the room they were invited to — wire it into the post-authentication path.
NoteIdempotent: with no pending invites it succeeds with an empty rooms array, so it is safe to call on every sign-in.

See also

inviteRoomMember · useRooms · listRooms

Source: src/api/client.ts (Rooms — email pre-authorization, P0-180) · Also available in llms-full.txt and registry.json.