Supervision
Build your own supervisor tools: read the floor, listen in on a rep's call, whisper to the rep, barge in or take the call over, and move waiting calls. The dashboard's wallboard (/floor) does the same.
const floor = await hcc.floor.get(); // { queues, reps, calls, queued } of the key's environment
for (const q of floor.queues) console.log(q.name, q.waiting, q.serviceLevel.value);
const monitor = await hcc.calls.monitor('call_123', {
mode: 'listen', // the default: you're muted
to: '+14155550142', // your phone, or 'client:<identity>' for a softphone
});
await monitor.setMode('whisper'); // only the rep hears you
await monitor.setMode('barge'); // everyone does
await monitor.mute(); // or mute(false)
await monitor.takeOver(); // barge first: the rep leaves, you keep the customer
await monitor.end(); // or leave
await hcc.queueCalls.reassign('call_456', { queue: 'support' }); // keeps its place in line
await hcc.queueCalls.reassign('call_456', { repId: 'rep_123' }); // a free rep gets the offer
await hcc.reps.setState('rep_123', 'offline'); // on a call, it applies when the call ends
export const sales = defineQueue('sales', {
serviceLevel: { answeredWithin: '30s', target: 0.9 }, // default 20s and 80%
});- What can be monitored. Calls with a rep on them. Anything else is 409
conflict, including AI agent calls (floor.calls[].monitorablesays which). One session per supervisor per call. When the rep leaves, the session ends (rep_left), unless you were barging: then you've taken the call over. - The rep is told. The desk shows "Sam is listening", unless the workspace's listening notice is off; whisper and barge always show. HCC never tells the customer.
- Reassign refuses a call that isn't waiting in a queue and a rep who isn't free (409). A rep who misses the offer puts the call back at the front of its queue.
- Events:
call.monitor.started,call.monitor.changed(withpreviousMode),call.monitor.ended(withreason:ended,rep_left,call_ended,hanguporfailed),call.monitor.took_over,queue.call.reassigned,rep.help.requested(a rep asked for help from the desk), andrep.state.changedwithbywhen a supervisor set it. Sessions started with an API key havesupervisorId: null. - Test mode. On a simulated call the simulator answers your leg; say things as the supervisor with
sim.supervisor.say('Offer the annual plan.').