Cubicl Docs


The chat feature is organized by chat threads and messages in the chat threads.


Get Chat Threads
Get Messages
Send Message


Chat Threads

Chat messages are sent in a thread. Threads have 3 types:
  1. 1.
    personal: Between 2 users. Created when a user sends a message to another user.
  2. 2.
    group: Created for each project. All project members are members of these threads.
  3. 3.
    custom: Created among a group of users by users themselves. This is a private chat group.
type ChatThread = {
_id: string;
type: 'personal' | 'group' | 'custom';
// Project id. Exists when type is 'group'
group?: string;
// Name of the thread. Exists when type is 'custom'
name?: string;
// Ids of users in the chat thread. Exists when type is 'personal' or 'custom'
users: string[];
// Date of last activity (message) in the thread
activity: number;
// Date at which current user viewed the thread. 0 if not accessed before.
access: number;
lastMessage: ChatMessage | null;
// Number of new messages since last access.
newActivityCount: number;
createdAt: number;

Chat Messages

type ChatMessage = {
_id: string;
// Thread id
thread: string;
// Id of the user who sent the message
from: string;
content: string;
// File attachments in the message. Check Files page for data format.
files: File[];
// Ids of the users who liked the message
likes: string[];
dislikes: string[];
// If a message is a reply to another message, this will be the referenced
// message id
replyTo: string | null;
createdAt: number;