From Bright Pattern Documentation
Jump to: navigation, search
(Updated via BpDeleteTranslateTags script)
 
(14 intermediate revisions by one other user not shown)
Line 1: Line 1:
<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 ==
+
= 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''.
+
Requests information about an agent's current state and interactions. getState uses a callback function with command GET_STATE to request agent state and interaction data.
  
 +
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.
 +
 +
== Request ==
 
=== Syntax ===
 
=== Syntax ===
 
  window.bpspat.api.getState(callback)
 
  window.bpspat.api.getState(callback)
Line 22: Line 22:
 
|}
 
|}
  
== 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 ==
=== Example 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 example shows the response you may get when you call ''getState''.
+
 
 +
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"}
  
{
 
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 ===
 
=== Response Fields ===
Line 52: Line 37:
 
| '''Data Type'''
 
| '''Data Type'''
 
| '''Description'''
 
| '''Description'''
 +
| '''Example'''
 
|-
 
|-
| data.agent_id
+
| agent_id
 
| string
 
| string
 
| agent username
 
| agent username
 +
| "john.smith"
 
|-
 
|-
| data.status
+
| status
 
| string
 
| string
| agent state (e.g., "Ready" or "Not Ready")
+
| agent state
 +
| "Not ready"
 
|-
 
|-
| data.reason
+
| reason
 
| string
 
| string
| Not Ready reason (e.g., "Lunch" or "Break")
+
| Not Ready reason
 +
| "Lunch"
 
|-
 
|-
| data.interactions
+
|interactions
 
| array
 
| array
| List of interaction data
+
| List of interaction data, including data items below
 +
| "item_id":"5B07EFE4-0658-45E0-AA6E-23AA042C1F0E","screenpop_data":{}
 
|-
 
|-
| data.item.id
+
| item.id
 
| string
 
| string
 
| Interaction ID
 
| Interaction ID
 +
| "5B07EFE4-0658-45E0-AA6E-23AA042C1F0E"
 
|-
 
|-
| data.global_id
+
| global_id
 
| string
 
| string
 
| Global interaction ID (GIID)
 
| Global interaction ID (GIID)
 +
| "0CB4F48D-C4D8-4C9F-94F5-770AD5002C40"
 
|-
 
|-
| data.phone_number
+
| phone_number
 
| string
 
| string
| Customer phone number
+
| Phone number dialed (either extension number or full number)
 +
| "1012"
 +
|-
 +
| recording_url
 +
| string
 +
| URL of the call recording
 +
| "/msgplayback?tenant_id=1F64161D-C1C4-4A57-8DC4-B6B2ED7412C8&rtp_processor_id=7C0DCA41-F507-42B9-9D40-0E3B9F302B9F&message=recordings/<tenant>.brightpattern.com/2019-02-09/72E82ED8-769D-4267-85D3-EC890D653240&key_id=D811EFBA-5F8A-4AE5-A80C-8F07B7372BEF&CRC=aaadd10b9dbee5e52dcf60fe104982dd"
 +
|-
 +
| request_id
 +
| number
 +
| Indicates how many times you have made the getState request
 +
| "3" (e.g., this is the third time requesting agent status information)
 
|-
 
|-
| data.service
+
| service
 
| string
 
| string
 
| Name of the service handling the interaction
 
| Name of the service handling the interaction
 +
| "Maintenance Renewal"
 
|-
 
|-
| data.screenpop_data
+
| screenpop_data
 
| string
 
| string
 
| Information shown on screen-pop
 
| Information shown on screen-pop
 +
| -
 
|-
 
|-
| data.attached_data
+
| attached_data
 
| object
 
| object
| File attachments
+
| Data attached to a call
|}
+
| -
 
 
 
 
== setStatus ==
 
Requests an agent routing state change (with or without a reason code).
 
 
 
=== Syntax ===
 
window.bpspat.api.setStatus(status, reason_code="")
 
 
 
=== Parameters ===
 
{|border="1" style="border-collapse:collapse" cellpadding="5"
 
| '''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>
 

Latest revision as of 04:02, 29 May 2024

• 5.19 • 5.3 • 5.8


getState

Requests information about an agent's current state and interactions. getState uses a callback function with command GET_STATE to request agent state and interaction data.

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.

Request

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"
recording_url string URL of the call recording "/msgplayback?tenant_id=1F64161D-C1C4-4A57-8DC4-B6B2ED7412C8&rtp_processor_id=7C0DCA41-F507-42B9-9D40-0E3B9F302B9F&message=recordings/<tenant>.brightpattern.com/2019-02-09/72E82ED8-769D-4267-85D3-EC890D653240&key_id=D811EFBA-5F8A-4AE5-A80C-8F07B7372BEF&CRC=aaadd10b9dbee5e52dcf60fe104982dd"
request_id number Indicates how many times you have made the getState request "3" (e.g., this is the third time requesting agent status information)
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 -
< Previous | Next >