Sales-assist widget in a CRM
Goal: while a rep is on a call, show real-time suggestions (objection handling, battlecards, missing questions, compliance reminders) inside the CRM record they already have open.
1. Create a playbook
The live advisor follows a playbook: stages, objections, battlecards and required disclosures, optionally grounded in a knowledge base.
import { Kolwire } from "@kolwire/sdk";
const vi = new Kolwire();
const kb = await vi.knowledgeBases.create({ name: "Pricing & product" });
await vi.knowledgeBases.addDocument(kb.id, { source: "pricing.md", content: "Starter is $49/seat/month…" });
const playbook = await vi.playbooks.create({
name: "SMB discovery",
knowledge_base_id: kb.id,
stages: [{ name: "Discovery", required_questions: ["How many seats?", "Current provider?", "Decision date?"] }],
objections: [{ trigger: "too expensive", response: "Anchor on time saved: reps save ~5h/week on logging." }],
battlecards: [{ competitor: "Acme Dialer", points: ["No live transcript", "Per-minute AI add-on"] }],
required_disclosures: ["This call may be recorded"],
});from kolwire import Kolwire
client = Kolwire()
kb = client.knowledge_bases.create(name="Pricing & product")
client.knowledge_bases.add_document(kb.id, source="pricing.md", content="Starter is $49/seat/month…")
playbook = client.playbooks.create(
name="SMB discovery",
knowledge_base_id=kb.id,
stages=[{"name": "Discovery", "required_questions": ["How many seats?", "Current provider?", "Decision date?"]}],
objections=[{"trigger": "too expensive", "response": "Anchor on time saved: reps save ~5h/week on logging."}],
battlecards=[{"competitor": "Acme Dialer", "points": ["No live transcript", "Per-minute AI add-on"]}],
required_disclosures=["This call may be recorded"],
)2. Turn the advisor on for a call
Either pass playbook_id when placing the call, or start it on a live call with the assist command:
await vi.calls.actions(callId, { commands: [{ command: "assist", playbook_id: playbook.id }] });client.calls.actions(call_id, commands=[{"command": "assist", "playbook_id": playbook.id}])Set whisper_audio: true to also whisper high-priority suggestions into the rep's ear (the customer never hears it).
3. Mint a call-scoped token for the CRM tab
Your CRM extension asks your backend for a token scoped to the call and to the assist + transcript scopes:
const { token } = await vi.streamTokens.create({ call_id: callId, scopes: ["assist", "transcript"], ttl_sec: 3600 });4. Render suggestions
import { StreamClient } from "@kolwire/sdk/realtime";
const stream = new StreamClient({
url: "wss://stream.kolwire.com/v1/stream",
token: () => fetch(`/api/assist-token?call=${callId}`).then((r) => r.json()).then((j) => j.token),
subscribe: { call_id: callId, events: ["call.assist.suggestion", "call.ended"] },
});
stream.on("call.assist.suggestion", ({ data: s }) => {
// s.kind: answer | objection | battlecard | missing_question | compliance | coaching | next_step
const card = document.createElement("div");
card.className = `card ${s.kind} ${s.priority}`;
card.innerHTML = `<strong></strong><p></p>`;
card.querySelector("strong")!.textContent = s.title;
card.querySelector("p")!.textContent = s.body;
document.querySelector("#assist")!.prepend(card);
});
stream.on("call.ended", () => stream.close());
await stream.connect();When the call ends you get call.intelligence.ready with the summary, extracted fields (from the playbook's extraction_schema) and scorecard — write them back to the CRM record from your webhook.
Don't want to build UI?
The embeddable widgets ship a ready-made sales-assist panel (React component and <script> web component, themeable) that takes the same call-scoped stream token.