livqenoDocs

ConceptsConversation

Conversation

A chat channel with saved history and a list of members.

A conversation is where chat messages live. It's chat's version of a room: your backend creates it and adds members, then your app connects with a chat token and sends messages.

Project → API key → backend creates a conversation, adds members, mints a chat token → app connects and chats.

Why it exists

Livqeno needs somewhere to decide "may Alice post here?". The answer comes from Alice's membership in the conversation and her role in it. Never from anything her app sends.

That's why there are two checks before Alice can chat:

  1. Her chat token must name the conversation.
  2. She must be a member of it.

Three types

type ChatConversationType = 'ROOM' | 'CHANNEL' | 'DIRECT';
TypeUse it forExample
ROOMThe chat panel of an RTC call. Linked to an RTC room.Chat during a telehealth visit
CHANNELA standalone channel that lasts a long time.#support, a team channel
DIRECTPrivate chat between a fixed group of people.Alice messaging Bob

All three use the same APIs. The type only changes how long it lives and how you find it. If you don't set a type, you get CHANNEL.

When to create a conversation

  • Chat next to a call: one conversation per call. Link it to the RTC room with roomId, so the chat belongs to the call.
  • A support ticket: one conversation per ticket, named after the ticket id.
  • Team channels: one long-lived CHANNEL per channel.

Like rooms, names are unique per project and environment. If many requests might create the same conversation at once, pass getOrCreate: true.

Created by your backend

Creating a conversation and managing members needs an API key. An app can't create a conversation or add itself to one, so a user can't let themselves into a chat they shouldn't see.

On your backend, create a support channel with Alice as admin and Bob as a member:

const conversation = await livqeno.chat.createConversation({
  type: 'CHANNEL',
  name: 'support-room-42',
  members: [{ userId: 'alice', role: 'ADMIN' }, { userId: 'bob' }],
});

Archiving

A conversation is ACTIVE or ARCHIVED. Archive a conversation when it's finished (a closed support ticket), but you still want people to read it.

  • Archived conversations can still be read.
  • Writing to one fails with RAVEN_CONVERSATION_ARCHIVED. Unarchive it first.

How long messages are kept

Forever, by default. Set CHAT_RETENTION_DAYS, or a per-conversation setting, and older messages are deleted automatically.

Common mistakes

MistakeWhat you'll seeFix
Token names the conversation, but the user isn't a memberROOM_NOT_FOUND on the first sendCall addMember on your backend before making the token.
Creating the same name twice without getOrCreate409 (RAVEN_CONFLICT)Pass getOrCreate: true.

Next steps

  1. Members: add, remove, and set roles.
  2. Message: what goes inside a conversation.
  3. Conversations: the full API.