01 Software

Threads

Create discussion threads, view tracking, trending threads

Threads

Threads are the top-level content in the community. Customers create threads, and other customers can comment, react, and bookmark them.

Create Thread

const thread = await client.community.createThread({
  title: 'How to integrate the SDK?',
  content: richTextContent,  // Lexical editor state
  categories: ['category-id'],  // optional
  thumbnail: 'image-id',  // optional
})

If the tenant requires moderation approval, new threads start with moderationStatus: 'pending' and are not visible until approved by an admin.

List Threads

// All published threads
const { docs: threads } = await client.from('threads').find({
  where: { moderationStatus: { equals: 'approved' } },
  sort: '-createdAt',
  limit: 20,
})

// Filter by category
const { docs } = await client.from('threads').find({
  where: {
    moderationStatus: { equals: 'approved' },
    categories: { contains: categoryId },
  },
})

My Threads

const { docs: myThreads } = await client.community.getMyThreads({
  page: 1,
  limit: 10,
})
// Top threads by reaction count
const { docs: trending } = await client.community.getTrending({
  limit: 10,
  period: '7d',  // '7d' | '30d'
})

Sort & Filter

// Most commented
const { docs } = await client.from('threads').find({
  where: { moderationStatus: { equals: 'approved' } },
  sort: '-commentCount',
})

// Most viewed
const { docs } = await client.from('threads').find({
  where: { moderationStatus: { equals: 'approved' } },
  sort: '-viewCount',
})

Thread Detail

const thread = await client.from('threads').findById(threadId, {
  depth: 1,  // Populate customer, categories
})
// thread.title, thread.content, thread.customer
// thread.viewCount, thread.commentCount, thread.reactionCount

Thread Detail Page

Fetch thread, comments, and reactions together for a detail page:

const [thread, { docs: comments }, reactions] = await Promise.all([
  client.from('threads').findById(threadId, { depth: 1 }),
  client.community.listComments({ threadId, page: 1, limit: 20 }),
  client.community.getReactionSummary({ threadId }),
])

View Tracking

Increment the view counter (rate-limited: 1 per IP per 60 seconds).

await client.community.incrementView({ threadId })

Update Thread

Customers can only update their own threads.

await client.from('threads').update(threadId, {
  title: 'Updated title',
  content: updatedRichText,
})

Customers cannot set isPinned — this is admin-only. Pinned threads appear at the top of listings.

Delete Thread

await client.from('threads').delete(threadId)

Deleting a thread cascades: all comments, reactions, bookmarks, and reports for that thread are also deleted.

Thread Categories

// List categories
const { docs: categories } = await client.from('thread-categories').find()

// Hierarchical — get children
const { docs: children } = await client.from('thread-categories').find({
  where: { parent: { equals: parentCategoryId } },
})

Collection Reference

For detailed field specifications, see Community Collections.

On this page