Members are the users who belong to a conversation. Only members can read or send in it, and each member's role decides what else they can do, like deleting other people's messages.
Where this fits: your backend creates a conversation, then adds members, then makes each member a chat token. Membership is the second of chat's two access checks; the token is the first. See Chat → Authorization.
When you'd add or remove members
| Situation | What your backend does |
|---|---|
| A customer opens a support ticket | Create the conversation with the customer and the agent as members. |
| Another agent takes over the ticket | addMember for the new agent. removeMember for the old one, if needed. |
| Someone joins a team channel | addMember. |
| Someone breaks the rules | removeMember. They lose access right away. |
| You promote a user to moderator | addMember again with role: 'MODERATOR'. |
A user id here is your own id for the user, like alice or a database
id. Livqeno doesn't have its own user accounts. Use the same id when you
make that user's chat token.
Roles
| Role | Can do | Typical user |
|---|---|---|
MEMBER | Read and send. This is the default. | A customer, a channel member |
MODERATOR | Everything a MEMBER can, plus delete anyone's message. | A support agent, a community moderator |
ADMIN | Everything a MODERATOR can, plus change the conversation's settings. | The channel owner |
A token can remove what a role allows, but never add to it. See Chat → Authorization.
Add a member
On your backend:
import { Livqeno } from '@livqeno/server';
const livqeno = new Livqeno({
apiKey: process.env.LIVQENO_API_KEY,
baseUrl: process.env.LIVQENO_API_URL, // https://api.livqeno.com
});
const member = await livqeno.chat.addMember('support-room-42', { userId: 'carol', role: 'MODERATOR' });
// { userId: 'carol', role: 'MODERATOR', status: 'ACTIVE', joinedAt: '...', leftAt: null }import os
from livqeno import Livqeno
livqeno = Livqeno(
api_key=os.environ["LIVQENO_API_KEY"],
base_url=os.environ["LIVQENO_API_URL"], # https://api.livqeno.com
)
member = livqeno.chat.add_member("support-room-42", "carol", role="MODERATOR")- No
role? It'sMEMBER. - Adding someone who is already a member is safe, so you can call it every time a user opens the chat.
- Adding someone who left brings back their old membership. Their past messages stay linked to them.
- Add the member before you make their chat token. If you don't, the
token response lists the conversation under
pendingMembership, and the user getsROOM_NOT_FOUNDuntil you add them.
List members
Use this on your backend to show a member list, or to check who has access:
const members = await livqeno.chat.listMembers('support-room-42');members = livqeno.chat.list_members("support-room-42")To show who's online right now in your app, use Presence instead. Membership says who may chat; presence says who is here.
Remove a member
On your backend:
await livqeno.chat.removeMember('support-room-42', 'carol');livqeno.chat.remove_member("support-room-42", "carol")What happens:
- Their membership
statusbecomesLEFT, andleftAtis set. - If they're connected, they're cut off from this conversation right
away. Their app gets a
NOT_A_MEMBERerror event, and they stop showing as online or typing. - They can't read or send here until you add them again. Their token for other conversations still works.
- Their old messages stay, and still show who wrote them.
Which SDKs can do this
| SDK | Manage members? |
|---|---|
@livqeno/server, livqeno (Python), the Go, Java and PHP server SDKs | Yes |
@livqeno/chat, @livqeno/react, @livqeno/react-native, livqeno_chat (Flutter) | No. They can only see who's online, with Presence. |
| CLI | No livqeno chat members command yet. Use the SDK or the REST API. |
Common errors
| Problem | Cause | Fix |
|---|---|---|
404 on addMember | The conversation can't be found. | Check the id, name, or roomId, and that your API key is for the right environment. See Conversation references. |
User gets ROOM_NOT_FOUND after you added them | Their token was made for a different conversation list, or a different user id. | Make sure the userId in addMember and in createToken match exactly. |
| A removed member's messages disappear | They shouldn't. Removal is soft. | Make sure you called removeMember, not deleteMessage. See Moderation. |
Production tips
- Update your UI when roles change. A demoted moderator keeps their token, but their next moderator action is refused.
- There's no bulk add yet. Add the first members when you create the
conversation with
createConversation({ members }), instead of callingaddMemberin a loop. - Use your own stable user ids. If a user's id changes in your system, they look like a new person to Livqeno.
Next steps
- Chat authentication: make a token for each member so their app can connect.
- Moderation: what moderators can do.
- Conversations: create and find conversations.