From Bright Pattern Documentation
Line 4: | Line 4: | ||
== getState == | == 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 === | === Syntax === | ||
window.bpspat.api.getState(callback) | window.bpspat.api.getState(callback) | ||
+ | callback = function(data) { | ||
+ | } | ||
=== Parameters === | === Parameters === | ||
Line 19: | Line 21: | ||
| JavaScript method executed when API method request is completed | | JavaScript method executed when API method request is completed | ||
|} | |} | ||
+ | |||
+ | == How to Use getState == | ||
+ | # Make sure the agent is logged in.<br /><br /> | ||
+ | # Click '''Get State''' to initiate the request.<br /><br /> | ||
+ | # View the response data on the page.<br /><br /> | ||
== Response == | == Response == | ||
− | The 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 === | ||
{|border="1" style="border-collapse:collapse" cellpadding="5" | {|border="1" style="border-collapse:collapse" cellpadding="5" | ||
| '''Name''' | | '''Name''' | ||
Line 68: | Line 93: | ||
| File attachments | | File attachments | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Revision as of 01:39, 7 February 2019
<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>