From Bright Pattern Documentation
Line 1: | Line 1: | ||
<translate> | <translate> | ||
= getState = | = getState = | ||
− | Requests information about an agent's current state and interactions. | + | 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''. |
− | + | See this specification's [[Embedded-agent-desktop-sdk-specification/UseCases/GetAgentStateInteractionInfo | Use Cases]] section for ways to use this method. | |
== Syntax == | == Syntax == | ||
Line 23: | Line 23: | ||
== Response == | == Response == | ||
− | |||
The following is an example of the response you may get when you call ''getState''. Every time the state changes, the logs display the updated agent state: | The following is an example of the response you may get when you call ''getState''. Every time the state changes, the logs display the updated agent state: | ||
Line 30: | Line 29: | ||
{"command":"STATE_CHANGED","data":{"agent_id":"jeffery.lozada","status":"not_ready","reason":"Not ready"}} | {"command":"STATE_CHANGED","data":{"agent_id":"jeffery.lozada","status":"not_ready","reason":"Not ready"}} | ||
{"command":"GET_STATE","data":{"agent_id":"jeffery.lozada","interactions":[{"item_id":"5B07EFE4-0658-45E0-AA6E-23AA042C1F0E","screenpop_data":{}}],"status":"ready","reason":""},"request_id":"2"} | {"command":"GET_STATE","data":{"agent_id":"jeffery.lozada","interactions":[{"item_id":"5B07EFE4-0658-45E0-AA6E-23AA042C1F0E","screenpop_data":{}}],"status":"ready","reason":""},"request_id":"2"} | ||
+ | |||
=== Response Fields === | === Response Fields === | ||
Line 81: | Line 81: | ||
| string | | string | ||
| Information shown on screen-pop | | Information shown on screen-pop | ||
− | | | + | | - |
|- | |- | ||
| attached_data | | attached_data | ||
| object | | object | ||
− | | | + | | Data attached to a call |
| - | | - | ||
|} | |} |
Revision as of 20:59, 8 February 2019
<translate>
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.
See this specification's Use Cases section for ways to use this method.
Syntax
window.bpspat.api.getState(callback) callback = function(data) { }
Parameters
Parameter | Type | Description |
callback | function | JavaScript method executed when API method request is completed |
Response
The following is an example of the response you may get when you call getState. Every time the state changes, the logs display the updated agent state:
Logs... {"command":"STATE_CHANGED","data":{"agent_id":"jeffery.lozada","status":"ready","reason":""}} {"command":"STATE_CHANGED","data":{"agent_id":"jeffery.lozada","status":"not_ready","reason":"Not ready"}} {"command":"GET_STATE","data":{"agent_id":"jeffery.lozada","interactions":[{"item_id":"5B07EFE4-0658-45E0-AA6E-23AA042C1F0E","screenpop_data":{}}],"status":"ready","reason":""},"request_id":"2"}
Response Fields
Name | Data Type | Description | Example |
agent_id | string | agent username | "john.smith" |
status | string | agent state | "Not ready" |
reason | string | Not Ready reason | "Lunch" |
interactions | array | List of interaction data, including data items below | "item_id":"5B07EFE4-0658-45E0-AA6E-23AA042C1F0E","screenpop_data":{} |
item.id | string | Interaction ID | "5B07EFE4-0658-45E0-AA6E-23AA042C1F0E" |
global_id | string | Global interaction ID (GIID) | "0CB4F48D-C4D8-4C9F-94F5-770AD5002C40" |
phone_number | string | Phone number dialed (either extension number or full number) | "1012" |
service | string | Name of the service handling the interaction | "Maintenance Renewal" |
screenpop_data | string | Information shown on screen-pop | - |
attached_data | object | Data attached to a call | - |
</translate>