Power dialer for a sales team
Goal: a team of human reps working a lead list — the dialer calls the next lead the moment a rep is free, reps disposition each call, and you sync outcomes to your CRM.
1. Set up reps, a queue and disposition codes
import { Kolwire } from "@kolwire/sdk";
const vi = new Kolwire();
const reps = await Promise.all(
["ana@acme.com", "ben@acme.com"].map((email) => vi.teamAgents.create({ name: email.split("@")[0], email, skills: ["sales"] })),
);
const queue = await vi.queues.create({
name: "Outbound sales",
strategy: "longest_idle",
members: reps.map((r) => ({ team_agent_id: r.id })),
});
for (const d of [
{ code: "meeting_booked", label: "Meeting booked", category: "positive" },
{ code: "not_interested", label: "Not interested", category: "negative" },
{ code: "call_back", label: "Call back later", category: "callback", recycle_after_min: 1440 },
{ code: "dnc", label: "Do not call", category: "dnc" },
] as const) await vi.dispositions.create(d);from kolwire import Kolwire
client = Kolwire()
reps = [client.team_agents.create(name=e.split("@")[0], email=e, skills=["sales"])
for e in ["ana@acme.com", "ben@acme.com"]]
queue = client.queues.create(name="Outbound sales", strategy="longest_idle",
members=[{"team_agent_id": r.id} for r in reps])
for d in [
{"code": "meeting_booked", "label": "Meeting booked", "category": "positive"},
{"code": "not_interested", "label": "Not interested", "category": "negative"},
{"code": "call_back", "label": "Call back later", "category": "callback", "recycle_after_min": 1440},
{"code": "dnc", "label": "Do not call", "category": "dnc"},
]:
client.dispositions.create(**d)Reps log in to the agent desktop (or your own UI with the softphone) using their SIP credentials; presence (available, on_call, wrap_up, break, offline) is managed there or via teamAgents.setStatus.
2. Create the campaign and import leads
const campaign = await vi.campaigns.create({
name: "Q3 SMB outbound",
from_number_ids: ["pn_123", "pn_456"],
dialer_mode: "power", // preview | power | predictive | parallel
queue_id: queue.id,
lines_per_agent: 1,
amd_enabled: true,
voicemail_drop_url: "https://cdn.example.com/vm.mp3",
calling_window: { start: "09:00", end: "18:00" }, // recipient local time
max_attempts: 3,
local_presence: true,
playbook_id: "pb_123", // live sales advisor for every call
});
const result = await vi.campaigns.import(campaign.id, {
contacts: [
{ phone_e164: "+15550100001", name: "Dana", variables: { company: "Initech" } },
{ phone_e164: "+15550100002", name: "Eli", variables: { company: "Hooli" } },
],
});
console.log(result); // { imported, skipped_dnc, skipped_invalid, duplicates }
await vi.campaigns.start(campaign.id);campaign = client.campaigns.create(
name="Q3 SMB outbound",
from_number_ids=["pn_123", "pn_456"],
dialer_mode="power",
queue_id=queue.id,
lines_per_agent=1,
amd_enabled=True,
voicemail_drop_url="https://cdn.example.com/vm.mp3",
calling_window={"start": "09:00", "end": "18:00"},
max_attempts=3,
local_presence=True,
playbook_id="pb_123",
)
result = client.campaigns.import_(campaign.id, contacts=[
{"phone_e164": "+15550100001", "name": "Dana", "variables": {"company": "Initech"}},
{"phone_e164": "+15550100002", "name": "Eli", "variables": {"company": "Hooli"}},
])
client.campaigns.start(campaign.id)Import checks every number against your DNC list and consent records. Use csv instead of contacts to upload a CSV with a phone column (other columns become variables).
3. Monitor
const stats = await vi.campaigns.stats(campaign.id); // dialed, connected, outcomes, abandon_rate
const board = await vi.wallboard.get(); // agents by status, queue depth, longest waitstats = client.campaigns.stats(campaign.id)
board = client.wallboard.get()Live changes stream as agent.status_changed, queue.entry.updated and call.queued events — subscribe with the realtime client for a live wallboard.
4. Sync dispositions to your CRM
When a rep submits the wrap-up form you receive call.dispositioned:
app.post("/webhooks", express.raw({ type: "application/json" }), async (req, res) => {
const event = await vi.webhooks.constructEvent(req.body, req.headers);
if (event.type === "call.dispositioned") {
const { call_id, code, notes, fields } = event.data;
const insights = await vi.calls.insights(call_id);
await crm.logCall({ callId: call_id, outcome: code, notes, fields, summary: insights.summary });
}
res.sendStatus(204);
});@app.post("/webhooks")
async def webhooks(request: Request):
event = client.webhooks.construct_event(await request.body(), request.headers)
if event.type == "call.dispositioned":
insights = client.calls.insights(event.data.call_id)
crm.log_call(event.data.call_id, event.data.code, event.data.notes, insights.summary)
return Response(status_code=204)You can also disposition from your own UI with vi.calls.disposition(callId, { code, notes, fields }).
Predictive mode
predictive dials ahead of available reps and caps the abandon rate (default 3%, the US TCPA limit) with a safe-harbor message. Read compliance before enabling it.