livqenoDocs

ChatMembers

Members

Add, remove, and list the people in a conversation, from your backend.

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

SituationWhat your backend does
A customer opens a support ticketCreate the conversation with the customer and the agent as members.
Another agent takes over the ticketaddMember for the new agent. removeMember for the old one, if needed.
Someone joins a team channeladdMember.
Someone breaks the rulesremoveMember. They lose access right away.
You promote a user to moderatoraddMember 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

RoleCan doTypical user
MEMBERRead and send. This is the default.A customer, a channel member
MODERATOREverything a MEMBER can, plus delete anyone's message.A support agent, a community moderator
ADMINEverything 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 }
  • No role? It's MEMBER.
  • 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 gets ROOM_NOT_FOUND until 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');

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');

What happens:

  1. Their membership status becomes LEFT, and leftAt is set.
  2. If they're connected, they're cut off from this conversation right away. Their app gets a NOT_A_MEMBER error event, and they stop showing as online or typing.
  3. They can't read or send here until you add them again. Their token for other conversations still works.
  4. Their old messages stay, and still show who wrote them.

Which SDKs can do this

SDKManage members?
@livqeno/server, livqeno (Python), the Go, Java and PHP server SDKsYes
@livqeno/chat, @livqeno/react, @livqeno/react-native, livqeno_chat (Flutter)No. They can only see who's online, with Presence.
CLINo livqeno chat members command yet. Use the SDK or the REST API.

Common errors

ProblemCauseFix
404 on addMemberThe 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 themTheir 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 disappearThey 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 calling addMember in 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