01 Software

Comments

Nested comments with 3-level threading

Comments

Comments support 3-level nesting (depth 0-2) and are scoped to threads.

Comment Structure

Thread
├── Comment (depth 0)
│   ├── Reply (depth 1)
│   │   └── Reply-to-reply (depth 2, max)
│   └── Reply (depth 1)
└── Comment (depth 0)

Create Comment

// Top-level comment
const comment = await client.community.createComment({
  threadId: 'thread-id',
  content: 'Great discussion!',
})

// Reply to a comment
const reply = await client.community.createComment({
  threadId: 'thread-id',
  content: 'I agree!',
  parentId: comment.id,
})

Maximum nesting depth is 3 levels (depth 0, 1, 2). Attempting to reply to a depth-2 comment will throw an error.

List Comments

// Top-level comments for a thread
const { docs: comments } = await client.community.listComments({
  threadId: 'thread-id',
  page: 1,
  limit: 20,
})

// Replies to a specific comment (by rootId)
const { docs: replies } = await client.community.listComments({
  threadId: 'thread-id',
  rootId: comment.id,
})

Update Comment

Customers can only edit their own comments. Edited comments are marked with isEdited: true.

const updated = await client.community.updateComment({
  commentId: 'comment-id',
  content: 'Updated content',
})
// updated.isEdited → true

Delete Comment

await client.community.deleteComment({
  commentId: 'comment-id',
})

Deleting a comment also removes all child comments and reactions on that comment.

Comment Reactions

See Reactions & Moderation for adding reactions to comments.

Collection Reference

For detailed field specifications, see Community Collections.

On this page