From Bright Pattern Documentation
<translate>
Agent State
Agent State is used to request an agent's state and interaction information, as well as to change an agent's state. Use either the getState or setStatus method.
getState
getState can be called any time to request information about an agent's current state and interactions.
Syntax
window.bpspat.api.getState(callback)
Parameters
Parameter | Type | Description |
callback | function (data) | JavaScript method executed when API method request is completed |
Response
The response object contains the following fields.
Name | Description |
data.agent_id | Agent username |
data.status | Agent state (e.g., "Ready" or "Not Ready") |
data.reason | Not Ready reason (e.g., "Lunch" or "Break") |
data.interactions | Interaction data |
data.item.id | Interaction ID (string) |
data.global_id | Global interaction ID (GIID; string) |
data.phone_number | Customer phone number |
data.service | Name of the service handling the interaction |
data.screenpop_data | Information shown on screen-pop |
data.attached_data | File attachments |
Example
{ data.agent_id: "john.smith"; data.status: "Not Ready"; data.reason: "Lunch" data.interactions: [ { data.item_id: "123123123"; data.global_id: "asd234asdf234df" data.phone_number: "55511122233" data.service: "Customer Support" data.screenpop_data: "Case: 123123" data.attached_data: {a:b, c:d} data.service: "Customer Support"; }, ... ] }
setStatus
Requests an agent routing state change (with or without a reason code).
Syntax
window.bpspat.api.setStatus(status, reason_code="")
Parameters
Parameter | Type | Description |
status | string | Specifies the agent state to be set |
reason_code | number | Specifies the reason for agent state change |
</translate>