JavaScript Quickstart
Five minutes from clone to working chat in JavaScript. Install, seed, wire the provider, drop in the library and chat components. Done.
One paste and your AI reads our docs and sets cStar up with you.
1. Install
bash
npm install @cstar.help/js 2. Seed sample data
Empty workspaces aren't fun to test against. Populate yours with realistic content first:
bash
cstar seed Creates 5 categories, 12 articles, 3 customers, and 5 tickets. Full breakdown over at the quickstart.
3. Wire 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/whoami 4. List Unresolved Tickets
List the tickets that still need an answer, from your server.
list-tickets.js
// List tickets that still need an answer. New ones arrive as 'new',
// so filter out the finished ones instead of asking for status 'open'.
const { data } = await cstar.tickets.list({ page: 1, pageSize: 50 });
const unresolved = data.filter((t) => !['resolved', 'closed'].includes(t.status));
console.log(`Found ${unresolved.length} unresolved tickets`);
for (const ticket of unresolved) {
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';
// Seeded with a test key (cstar seed)? Add publishableKey: 'pk_test_...' to read test articles.
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