addRoomMember
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
| Param | Type | Notes | Description |
|---|---|---|---|
credentials | FlowstackCredentials | required | Credentials of a user who is already a member of the room. |
roomId | string | required | The room to add to. |
userId | string | required | The user id to add. Not an email — see inviteRoomMember for email addressing. |
config | FlowstackClientConfig | — | Client config. appScope is required — the function throws without it. |
Returns
| Field | Type | Description |
|---|---|---|
| — | 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 memberWarningRequires 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.