JavaScript Quickstart
Five minutes from clone to working chat in JavaScript. Install, seed, wire the provider, drop in the library and chat components. Done.
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. 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