Skip to main content

Agents

Manage agents and agent groups (v2 manager API) — CRUD, presence and status, lifecycle controls, CSV import/export, activity logs, and bulk actions. Available as mgr.agents (TypeScript) / mgr.Agents (Go) / mgr.agents (Rust), with a nested groups sub-resource.

List agents (auto-paginated)

for await (const agent of mgr.agents.list({ enabled: true })) {
console.log(agent.id, agent.name);
}
const all = await mgr.agents.listAll({ q: "support" });

Filters: free-text q, enabled, name, number, sourceId, state (line status), source, and the group/tag restrictions groupIds, groups, tags (Go currently exposes groupIds). Rust's list_all collects every page unfiltered; list and list_page take a ListAgentsQuery.

Create, get, update, delete

const created = await mgr.agents.create({ /* RestCreateAgentBody */ });
const agent = await mgr.agents.get(created.item.id);
await mgr.agents.update(agent.item.id, { /* RestUpdateAgentBody */ });
await mgr.agents.delete(agent.item.id);

Update status

const status = await mgr.agents.updateStatus(agentId, { enabled: true });
console.log(status.line_status, status.display_status);

Presence, status & lifecycle

Manage the workspace's named agent presences (custom away/availability states), inspect an agent's aggregate status and the list of available statuses, and drive an agent's lifecycle (enable / disable / force-hangup the active call).

const presences = await mgr.agents.presences();
const p = await mgr.agents.createPresence({ /* AgentPresenceWriteBody */ });
await mgr.agents.updatePresence(p.item.name, { /* … */ });
await mgr.agents.getPresence(p.item.name);
await mgr.agents.deletePresence(p.item.name);

const statuses = await mgr.agents.availableStatuses();
const status = await mgr.agents.getStatus(agentId);

await mgr.agents.enable(agentId);
await mgr.agents.disable(agentId);
await mgr.agents.hangupCall(agentId);

Agent groups

Agent groups live under agents.groups / Agents.Groups / agents.groups.

for await (const group of mgr.agents.groups.list()) console.log(group.name);
const group = await mgr.agents.groups.create({ /* RestCreateAgentGroupBody */ });
await mgr.agents.groups.addAgent(group.item.id, agentId);
await mgr.agents.groups.delete(group.item.id);

Provisioning, logs & bulk actions

Bulk enable/disable/delete agents, CSV import/export (with a validate-only dry run and an async import job), per-agent and global activity logs, push notifications, password updates, and group membership management.

await mgr.agents.bulkAction("enable", { ids: [id1, id2] });
const csv = await mgr.agents.export("csv");
const check = await mgr.agents.validateImport(csvFile); // dry run
const res = await mgr.agents.import({ file: csvFile, format: "csv", createOnly: true });
const job = await mgr.agents.getImportJob(jobId);

for await (const entry of mgr.agents.logs(agentId, { from, to })) console.log(entry.id);
for await (const entry of mgr.agents.allLogs()) console.log(entry.id);

await mgr.agents.push({ /* AgentPushRequest */ });
await mgr.agents.updatePassword(agentId, { /* AgentPasswordUpdateRequest */ });

for await (const a of mgr.agents.groups.listAgents(groupId)) console.log(a.id);
await mgr.agents.groups.removeAgent(groupId, agentId);
await mgr.agents.groups.bulkDelete([groupId1, groupId2]);

Reference