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 getState or setStatus.
getState
Requests information about an agent's current state and interactions. Note that the agent must be logged in to Agent Desktop in order to use getState.
Syntax
window.bpspat.api.getState(callback) callback = function(data) { }
Parameters
Parameter | Type | Description |
callback | function | JavaScript method executed when API method request is completed |
How to Use getState
- Make sure the agent is logged in.
- Click Get State to initiate the request.
- View the response data on the page.
Response
Example Response
The following example shows the response you may get when you call getState.
{ 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"; }, ... ] }
Response Fields
Name | Data Type | Description |
data.agent_id | string | agent username |
data.status | string | agent state (e.g., "Ready" or "Not Ready") |
data.reason | string | Not Ready reason (e.g., "Lunch" or "Break") |
data.interactions | array | List of interaction data |
data.item.id | string | Interaction ID |
data.global_id | string | Global interaction ID (GIID) |
data.phone_number | string | Customer phone number |
data.service | string | Name of the service handling the interaction |
data.screenpop_data | string | Information shown on screen-pop |
data.attached_data | object | File attachments |
setStatus
Requests an agent routing state change (with or without a reason code).
Syntax
window.bpspat.api.setStatus(status, reason_code="")
Parameters
Parameter | Data Type | Required/Optional | Description |
status | string | required | Specifies the agent state to be set |
reason_code | number | optional | Specifies the reason for agent state change |
</translate>