From Bright Pattern Documentation
Jump to: navigation, search
(Created page with "<translate> = setStatus = Requests an agent routing state change (with or without a reason code). == Syntax == window.bpspat.api.setStatus(status, reason_code="") For examp...")
 
Line 1: Line 1:
 
<translate>
 
<translate>
 
= setStatus =
 
= setStatus =
Requests an agent routing state change (with or without a reason code).
+
Requests an agent routing state change (with or without a reason code). setStatus uses a callback function with command CHANGE_STATE to set the agent state and reason.
 +
 
 +
Note that the agent must be logged in to Agent Desktop in order to use setStatus. See this specification's [[Embedded-agent-desktop-sdk-specification/UseCases/ChangeAgentState |  Use Cases]] section for ways to use this method.
  
 
== Syntax ==
 
== Syntax ==
  window.bpspat.api.setStatus(status, reason_code="")
+
  window.bpspat.api.setStatus(status,reason_code="")
  
 
For example:
 
For example:
Line 27: Line 29:
 
|}
 
|}
  
== Sample Code ==
 
The following is the minimum that you need to paste into your HTML webpage in order to use ''setStatus''.
 
 
<script type="text/javascript" src="https://<tenant>.brightpattern.com/agentdesktop/libs/servicepattern-sdk-v1.js"> </script>
 
//JavaScript that calls on your tenant's (contact center's) Agent Desktop and the SDK libraries. In the source, replace "<tenant>" with your actual Agent Desktop web server name.
 
 
<iframe id="repeater" style="position:absolute; right: 8px; width: 200px; height: 200px;" src="https://<tenant>.brightpattern.com/agentdesktop/UniversalRepeater.jsp"></iframe>//The Agent Desktop widget ("repeater") and display properties. In the source, replace "<tenant>" with your actual Agent Desktop web server name.
 
   
 
<button onclick="bpspat.api.setStatus('READY')">Set Status</button>
 
//HTML element with setStatus method  attached to set agent state to Ready.
 
 
  <<nowiki />div id="log">Logs...</div>//Logs section.
 
 
<script type="text/javascript">
 
            //initiate script with origin of Agent Desktop embedded on the page
 
            window.bpspat.api.init(window.location.href.substring(0, window.location.href.indexOf("/agentdesktop/AgentDesktopSdkTest.jsp")));//remove suffix, pass origin
 
 
            document.getElementById("repeater").src = window.location.href.replace("AgentDesktopSdkTest", "UniversalRepeater");
 
 
            function log(data) {
 
                let div = document.createElement("div");
 
                div.innerHTML = JSON.stringify(data);
 
                document.getElementById("log").appendChild(div);
 
            }
 
 
            window.bpspat.api.addStatusChangeHandler(log);
 
</script>
 
 
== How to Use setStatus ==
 
# Paste the above sample code onto your page.<br /><br />
 
# Save and open the page in your web browser.<br /><br />
 
# Make sure the agent is logged in.<br /><br />
 
# Click the '''Set Status''' button to initiate the request.<br /><br />
 
# View the response data on the page.<br /><br />
 
  
  

Revision as of 22:19, 8 February 2019

• 5.19 • 5.3 • 5.8

<translate>

setStatus

Requests an agent routing state change (with or without a reason code). setStatus uses a callback function with command CHANGE_STATE to set the agent state and reason.

Note that the agent must be logged in to Agent Desktop in order to use setStatus. See this specification's Use Cases section for ways to use this method.

Syntax

window.bpspat.api.setStatus(status,reason_code="")

For example:

window.bpspat.api.setStatus('READY')

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>

< Previous | Next >