Analytics
cstar.analytics rolls up the numbers: ticket volume, response times, CSAT, library
usage and agent performance. Most calls accept a period filter. Performance and CSAT
also take an agentId for per-person breakdowns.
Overview
overview.js
const overview = await cstar.analytics.overview({
period: 'week' // 'day' | 'week' | 'month' | 'quarter'
});
// { tickets: { total, new, closed, open }, priorities, statusBreakdown,
// responseTime: { avgSeconds, samplesCount }, resolutionTime: { ... } } Agent performance
performance.js
const { agents } = await cstar.analytics.performance({
period: 'month',
// The agent's userId from members.list(). Omit for every agent.
agentId: '550e8400-e29b-41d4-a716-446655440001'
});
// agents: [{ agentId, ticketsClosed, avgResponseSeconds, goldTier, missedSla }] Library stats
How the public knowledge base is performing: top articles, search queries, view counts.
library.js
const library = await cstar.analytics.library({ period: 'month' }); CSAT
csat.js
// Aggregate stats
const stats = await cstar.analytics.csatStats({ period: 'month' });
// Per-agent stats
const agentStats = await cstar.analytics.csatStats({
period: 'month',
agentId: '550e8400-e29b-41d4-a716-446655440001'
});
// Read + update CSAT delivery settings
const settings = await cstar.analytics.csatSettings();
await cstar.analytics.updateCsatSettings({ deliveryMode: 'after_resolved' }); CSAT surveys
List, inspect and send individual survey records with cstar.analytics.csatSurveys. The rollups above summarize the same rows.
csat-surveys.js
const { data: surveys } = await cstar.analytics.csatSurveys.list({
completed: 'true', // only answered surveys
agentId: '550e8400-e29b-41d4-a716-446655440001',
page: 1,
pageSize: 20
});
const survey = await cstar.analytics.csatSurveys.get('csat_abc123');
// Create a survey for a ticket
const created = await cstar.analytics.csatSurveys.create({
ticketId: 'tkt_abc123'
});