Overview
useAddMember returns a callable function that adds a user to a space directly. The user becomes an active member at once, with no request or approval step. The signed-in user must be an active moderator or admin of the space.
This is how users get into a private space, which can’t be joined. A user with a pending or rejected membership becomes active; a user who is already an active member is left as they are. A banned user can’t be added until they are unbanned (409 space/member-banned), nor can a user banned in a parent space (409 space/banned-in-parent). A user can’t be added when there is a block between them and the adder, in either direction, or when they are suspended (403 space/user-cannot-be-added; the response doesn’t say which). The added user gets a space-member-added notification. See Add Member for every case and error.
Usage Example
Parameters
string
required
UUID of the space.
string
required
UUID of the user to add.
Returns
string
"User added to the space.", or "User is already a member of this space." when nothing changed.object
The user’s membership:
id, spaceId, userId, role (member for a user just added; an existing active member keeps their role), status: "active", joinedAt and createdAt.
