Rolebase Developers
API Reference

thread_activity

Represents an activity or interaction within a thread. Activities include messages, polls, and references to other entities, forming the conversation content of a thread.

Fields

Field Type Description
id uuid Unique identifier for the activity (auto-generated)
threadId uuid Reference to the parent thread
userId uuid Reference to the user who created the activity
type Thread_Activity_Type_Enum Type of activity: Message, Poll, Thread, Meeting, Task, Decision, MeetingNote, or ChangeStatus
data JSON Activity content (format depends on type)
createdAt timestamptz When the activity was created (defaults to current timestamp)
refThreadId uuid Optional reference to another thread
refMeetingId uuid Optional reference to a meeting
refTaskId uuid Optional reference to a task
refDecisionId uuid Optional reference to a decision

Activity Types

The type field accepts the following enum values:

  • Message — Text message or rich content
  • Poll — Poll for gathering opinions
  • Thread — Reference to another thread
  • Meeting — Reference to a meeting
  • Task — Reference to a task
  • Decision — Reference to a decision
  • MeetingNote — Note created during a meeting
  • ChangeStatus — Thread status change

Relationships

Object Relationships

  • thread — The thread this activity belongs to
  • user — The user who created the activity
  • refThread — Optional referenced thread
  • refMeeting — Optional referenced meeting
  • refTask — Optional referenced task
  • refDecision — Optional referenced decision

Array Relationships

Query Examples

List Thread Activities

query GetThreadActivities($threadId: uuid!) {
  thread_activity(
    where: { threadId: { _eq: $threadId } }
    order_by: { createdAt: asc }
  ) {
    id
    threadId
    userId
    createdAt
    type
    data
    reactions {
      id
      shortcode
      userId
    }
    refThread {
      id
      title
    }
    refMeeting {
      id
      title
    }
    refTask {
      id
      title
    }
    refDecision {
      id
      title
    }
  }
}

Mutation Examples

Create a Thread Activity

mutation CreateThreadActivity {
  insert_thread_activity_one(
    object: {
      threadId: "123e4567-e89b-12d3-a456-426614174000"
      userId: "123e4567-e89b-12d3-a456-426614174001"
      type: Message
      data: { message: "Hello team!" }
    }
  ) {
    id
    type
    data
    createdAt
  }
}

Update a Thread Activity

mutation UpdateThreadActivity {
  update_thread_activity_by_pk(
    pk_columns: { id: "123e4567-e89b-12d3-a456-426614174002" }
    _set: { data: { message: "Updated message" } }
  ) {
    id
    data
    createdAt
  }
}

Permissions

Thread activity access is controlled through Hasura permissions and row-level security:

  • View — Users can view activities in threads they have access to
  • Create — Users can create new activities in threads they have access to
  • Update — Users can update their own activities. MeetingNote activities can also be updated by users with access to the thread
  • Delete — Users can delete their own activities. Organization admins and owners can delete any activity

The data field structure varies based on the activity type. Activities are ordered chronologically within a thread and support reactions with aggregation. The reference fields allow activities to link to other entities for context.