Docs / data / addRoomMember

addRoomMember

utilitysince 0.6.0

Client function: add an existing user to a room by user id.

import { addRoomMember } from 'flowstack-sdk'

Non-React client function. POST /rooms/{roomId}/members. Adds a member immediately — use inviteRoomMember instead when you only have an email address or the person may not have an account yet.

Signature

addRoomMember(credentials, roomId, userId, config?): Promise<ApiResponse<{ room_id: string; member_id: string }>>

Parameters

ParamTypeNotesDescription
credentialsFlowstackCredentialsrequiredCredentials of a user who is already a member of the room.
roomIdstringrequiredThe room to add to.
userIdstringrequiredThe user id to add. Not an email — see inviteRoomMember for email addressing.
configFlowstackClientConfigClient config. appScope is required — the function throws without it.

Returns

FieldTypeDescription
Promise<ApiResponse<{ room_id: string; member_id: string }>>The room and the member that was added.

Examples

Add a member
const res = await addRoomMember(credentials, roomId, userId, { appScope });
if (!res.ok) console.error(res.error); // 403 when the caller is not a member
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.
WarningReturns 403 unless the caller is already a member of the room. There is no room-owner role — any member can add any other member, so treat membership itself as the grant.

See also

useRooms · inviteRoomMember · createRoom

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