mv.agents
Human agents’ status and presence. These methods are on mv.agents, where mv is your client (see the Node.js SDK). Each one returns the response object and throws when the API answers with an error.
retrieveStatus()
Section titled “retrieveStatus()”Retrieve an agent’s status. A user’s presence as a human agent: available, busy on a call, in wrap-up, away or offline, and the queues they answer. id is the user’s ID.
mv.agents.retrieveStatus(id: AgentsRetrieveStatusData["path"]["id"], options?: RequestOptions): Promise<AgentsRetrieveStatusResponse>GET /agents/{id}/status · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A user ID (usr_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”AgentStatus:
| Field | Type | Description |
|---|---|---|
object |
"agent_status" |
Always agent_status. |
user_id |
string |
A user ID (prefix usr_). |
livemode |
boolean |
true in live mode, false in test mode. |
status |
"available" | "busy" | "wrap_up" | "away" | "offline" |
available and away are chosen by the agent; busy and wrap_up follow their calls; offline: not signed in. |
since |
string | null |
When the status began (null while offline). |
ringing |
boolean |
A queue call is ringing the agent right now. |
call |
object | null |
The call the agent is on. |
wrap_up_until |
string | null |
— |
queue_ids |
string[] |
Enabled queues the agent answers. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const agentStatus = await mv.agents.retrieveStatus("usr_7Hk2Lm9Qp");console.log(agentStatus);