chat module powers direct, group, and space conversations — sending and
editing messages (with file attachments), managing members, reacting, and tracking
read state. All actions are performed as the logged-in user.
Two list endpoints use cursor (keyset) pagination, not
page/limit:
listConversations and listMessages.
Their return shapes differ from the standard PaginatedResponse — see each
below.listConversations
Lists the user’s conversations, newest activity first, with keyset pagination.string
Comma-separated conversation types to include, e.g.
"direct,group,space".string
Keyset cursor — the
lastMessageAt (ISO datetime) of the last item from the
previous page.string
Tie-breaker cursor — the
createdAt (ISO datetime) of the last item from the
previous page.number
Page size. Defaults to
20, max 50.Promise<{ conversations: ConversationPreview[]; hasMore: boolean }>.
Each ConversationPreview includes otherMembers — up to 5 active members other than the current user (id, name, username, avatar) for direct/group conversations, so a DM/group can render the counterparty without a separate members fetch. Capped at 5 (use memberCount for the group total); empty for space conversations.
createDirectConversation
Creates (or returns the existing) 1:1 direct conversation with another user.string
required
The other participant’s Sublay user ID.
Promise<Conversation>
createGroupConversation
Creates a group conversation.string
Group name.
string
Group description.
string[]
Sublay user IDs to add to the group. Defaults to an empty list.
object
Arbitrary key-value data attached to the conversation.
Promise<Conversation>
getConversation
Fetches a single conversation by ID.string
required
The conversation ID.
Promise<Conversation>
updateConversation
Updates a conversation’s settings.string
required
The conversation ID.
string
New name.
string
New description.
string | null
File ID for the conversation avatar, or
null to clear it."members" | "admins"
Space conversations only: who may post.
Promise<Conversation>
deleteConversation
Deletes a conversation.string
required
The conversation ID.
Promise<{ message: string }>
getUnreadCount
Returns the user’s total unread message count and unread-conversation count. Takes no arguments.Promise<{ totalUnread: number; unreadConversationCount: number }>
listMembers
Lists the members of a conversation (standard page-based pagination).string
required
The conversation ID.
number
Page number (1-indexed).
number
Results per page.
"admin" | "member"
Filter members by role.
string
Opts each returned member into a
spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the conversation’s space). The empty string and the legacy general / null aliases are rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<PaginatedResponse<ConversationMember>>
addMember
Adds a user as a member of a conversation.string
required
The conversation ID.
string
required
The user to add (the target member).
Promise<ConversationMember>
removeMember
Removes a member from a conversation.string
required
The conversation ID.
string
required
The member to remove (the target).
Promise<{ message: string }>
changeMemberRole
Changes a member’s role within a conversation.string
required
The conversation ID.
string
required
The member whose role to change (the target).
"admin" | "member"
required
The new role.
Promise<ConversationMember>
leaveConversation
The logged-in user leaves a conversation.string
required
The conversation ID.
Promise<{ message: string }>
listMessages
Lists messages in a conversation with keyset (before/after) pagination.string
required
The conversation ID.
string
Restrict to replies of this message (thread view).
string
Keyset cursor (ISO timestamp) — return messages created before this. Mutually
exclusive with
after.string
Keyset cursor (ISO timestamp) — return messages created after this. Mutually
exclusive with
before.number
Page size. Defaults to
50, max 100."asc" | "desc"
Sort direction by creation time.
string
Comma-separated associations to populate, e.g.
"files".MessageFilters
Optional filters.
filters.hasReplies (boolean): when true, returns only
messages that have thread replies (threadReplyCount > 0); when false, only
messages with none. Filters by thread replies, not quotings.Threads are one level deep, so hasReplies: true together with parentId
always returns an empty list — the response’s notice field explains why.string
Opts each message sender into a
spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the conversation’s space). The empty string and the legacy general / null aliases are rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<{ messages: ChatMessage[]; hasMore: boolean; oldestCreatedAt: string | null; newestCreatedAt: string | null }>.
sendMessage
Sends a message to a conversation, optionally with file attachments. Whenfiles
is provided the request is sent as multipart/form-data (pass browser File /
Blob objects); otherwise it is a plain JSON body.
string
required
The conversation ID.
string
Message text.
GifData | null
An attached GIF, or
null.Mention[]
User mentions embedded in the message.
string
The message this is a threaded reply to.
string
A message being quoted.
object
Arbitrary key-value data attached to the message.
string
A client-generated ID echoed back on the created message (for optimistic UI);
not stored.
(Blob | File)[]
Up to 10 file attachments, as browser
File / Blob objects. Triggers a
multipart/form-data upload.string
Opts the created message’s sender into a
spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the conversation’s space). The empty string and the legacy general / null aliases are rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<ChatMessage>
getMessage
Fetches a single message by ID.string
required
The conversation ID.
string
required
The message ID.
string
Opts the message sender into a
spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the conversation’s space). The empty string and the legacy general / null aliases are rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<ChatMessage>
editMessage
Edits an existing message.string
required
The conversation ID.
string
required
The message ID.
string
New message text.
string | null
A GIF URL, or
null to clear it.Mention[]
Updated mentions.
object | null
Updated metadata, or
null to clear it.Promise<ChatMessage>
deleteMessage
Deletes a message in a conversation.string
required
The conversation ID.
string
required
The message ID.
Promise<{ message: string; userDeletedAt?: string }> (userDeletedAt
is set when the author soft-deletes their own message).
reportMessage
Reports a message for moderation.string
required
The conversation ID.
string
required
The message ID.
string
required
Why the message is being reported.
string
Additional detail.
Promise<{ message: string; code: string }>
toggleReaction
Toggles (adds or removes) an emoji reaction on a message for the logged-in user.string
required
The conversation ID.
string
required
The message ID.
string
required
The reaction emoji (1–10 characters).
Promise<{ reactionCounts: Record<string, number>; userReactions: string[]; delta: 1 | -1 }>
listReactions
Lists the users who reacted to a message with a given emoji.string
required
The conversation ID.
string
required
The message ID.
string
required
The reaction emoji to list reactors for.
number
Page number. Defaults to
1.number
Results per page. Defaults to
50, max 100.string
Opts each returned reactor into a
spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the conversation’s space). The empty string and the legacy general / null aliases are rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<{ data: MessageReaction[]; pagination: { page: number; limit: number; total: number; hasMore: boolean } }>,
where MessageReaction is { user: User; emoji: string; createdAt: Date }.
markAsRead
Marks a conversation as read up to a given message.string
required
The conversation ID.
string
required
The message up to which the conversation is marked read.
Promise<{ message: string }>
