Skip to main content

Community

CommunityClient from @cstar.help/js/community reads and writes the public forum. Topics, posts, comments, votes, follows. No API key for reads; identify with HMAC for write actions tied to a known customer.

Setup

setup.js
import { CommunityClient } from '@cstar.help/js/community';

const community = new CommunityClient({
  teamSlug: 'acme',
  // Optional: scope to test data with publishableKey: 'pk_test_...'
});

Browse

browse.js
const topics = await community.topics();

const posts = await community.posts({
  topicSlug: 'feature-requests',
  sort: 'votes',          // 'recent' | 'votes' | 'comments'
  limit: 20,
  offset: 0
});

const detail = await community.post('dark-mode-support');
// → { post, comments }
search.js
const results = await community.search('dark mode');
// results.data    — matching posts with highlighted excerpts
// results.count   — total matches

Post + comment + vote

write.js
// Create a post
const post = await community.createPost({
  topicId: 'topic_feature_requests',
  title: 'Dark mode for the dashboard',
  body: 'Late-night agents are squinting. Plz.'
});

// Comment
await community.comment(post.id, { body: '+1, my eyes thank you' });

// Vote (toggle)
await community.vote(post.id);

// Follow for notifications
await community.follow(post.id);

// Check vote status (single + bulk)
const voted = await community.getVoteStatus(post.id);
const status = await community.bulkVoteStatus([post.id, 'post_other']);

Update + delete

moderate.js
await community.updatePost(post.id, { title: 'Updated title' });
await community.deletePost(post.id);

await community.updateComment(post.id, commentId, { body: 'Edited.' });
await community.deleteComment(post.id, commentId);

Admin-side community

For server-side moderation (managing topics, marking posts as official, bulk operations), reach for cstar.community.posts and cstar.community.topics on the admin CStarClient. Same backend, different surface.

Next up