claimRoomInvites
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
| Param | Type | Notes | Description |
|---|---|---|---|
credentials | FlowstackCredentials | required | The signing-in user's credentials. |
config | FlowstackClientConfig | — | Client config. appScope is required — the function throws without it. |
Returns
| Field | Type | Description |
|---|---|---|
| — | 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.