JavaScript Quickstart
Build a cStar integration with JavaScript in under 5 minutes. This guide covers installation, seeding sample data, provider setup, knowledge base browsing, customer chat, and article search.
1. Install
npm install @cstar.help/js2. Seed Sample Data
If you haven't already, populate your team with sample help center content so you have data to work with:
cstar seedThis creates 5 categories, 12 articles, 3 customers, and 5 tickets. See the quickstart for details.
3. Set Up the Client
client.js
import { CStarClient } from '@cstar.help/js';
// Admin API client (server-side only)
const cstar = new CStarClient({
apiKey: process.env.CSTAR_API_KEY,
teamId: process.env.CSTAR_TEAM_ID
});
// Don't know your teamId? Use the /whoami endpoint:
// curl -H "Authorization: Bearer sk_live_..." https://www.cstar.help/api/v1/auth/whoami4. Browse the Knowledge Base
List categories and articles from your public help center.
browse.js
// List open tickets
const { data: tickets, pagination } = await cstar.tickets.list({
status: 'open',
page: 1,
pageSize: 10
});
console.log(`Found ${pagination.total} open tickets`);
for (const ticket of tickets) {
console.log(`[${ticket.priority}] ${ticket.title}`);
}5. Create a Ticket
Create a new ticket from your server.
create-ticket.js
// Create a new ticket
const ticket = await cstar.tickets.create({
title: 'Login page shows blank screen',
priority: 'high',
customerName: 'Jane Smith',
tags: 'bug,login'
});
console.log('Created ticket:', ticket.id);6. Public Knowledge Base
Query your public knowledge base — no auth required.
library.js
// Public knowledge base (no auth required)
import { LibraryClient } from '@cstar.help/js/library';
const library = new LibraryClient({ teamSlug: 'acme' });
// Browse categories
const categories = await library.categories();
// Search articles
const results = await library.search('reset password');
// Get a single article
const article = await library.article('getting-started');What's Next?
- Full API Reference — All endpoints and parameters
- SDK Documentation — Detailed JavaScript SDK reference
- Webhooks Guide — Event types, signing, and verification
- CLI Reference — Local development tools