From Bright Pattern Documentation
Jump to: navigation, search
• 5.3 • 5.8


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.



callback = function(data) {


Parameter Type Description
callback function JavaScript method executed when API method request is completed


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:

{"command":"STATE_CHANGED","data":{"agent_id":"jeffery.lozada","status":"not_ready","reason":"Not ready"}}

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":{} 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>"
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 >