No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<translate> | <translate> | ||
= Call Someone = | = Call Someone on Specific Service = | ||
You can use the [[Embedded-agent-desktop- | You can use the [[Embedded-agent-desktop-api-specification/Methods/dialNumber | dialNumber]] method to dial a phone number and initiate a call for a logged-in agent. | ||
Using dialNumber alongside [[5.3:Embedded-agent-desktop-api-specification/Methods/selectService | selectService]] provides added control over a call. When used together, you can select the service to be used. The [[Embedded-agent-desktop-api-specification/Methods/getState | getState]] method retrieves agent state and interaction information in the logs. | |||
Methods can be attached to web elements, such as buttons, on your webpage. When clicked, the buttons will process the API methods. Add fields to enter the phone number to be dialed and the name of the service to use. | |||
In this article, you will learn how to: | In this article, you will learn how to: | ||
* Attach dialNumber to | * Attach getState, dialNumber, and selectService to buttons | ||
* Add | * Add fields | ||
* Place sample JavaScript into HTML | * Place sample JavaScript into HTML | ||
== Sample Code == | |||
In this sample code, the methods are attached to button elements. | |||
Copy this sample code for pasting into your HTML file. This is the bare minimum that you need for the SDK to work. Make sure you replace "<tenant>" with the name of your Agent Desktop web server (e.g., "example.brightpattern.com"). | |||
= | <syntaxhighlight lang="javascript"> | ||
<script type="text/javascript" src="https://<tenant>.brightpattern.com/agentdesktop/libs/servicepattern-sdk-v1.js"> | <script type="text/javascript" src="https://<tenant>.brightpattern.com/agentdesktop/libs/servicepattern-sdk-v1.js"> | ||
</script> | </script> | ||
<iframe id="repeater" style="position:absolute; right: 8px; width: 300px; height: 700px;" src="https://<tenant>.brightpattern.com/agentdesktop/UniversalRepeater.jsp"></iframe> | <iframe id="repeater" style="position:absolute; right: 8px; width: 300px; height: 700px;" src="https://<tenant>.brightpattern.com/agentdesktop/UniversalRepeater.jsp"></iframe> | ||
<input id="number" type="text" placeholder="Dial number"/> | <button onclick="bpspat.api.getState(log)">Get State</button> | ||
<button onclick="bpspat.api.dialNumber(document.getElementById('number').value)">Dial</button> | <br> | ||
<br> | |||
<input id="service" type="text" placeholder="Service name"/> | |||
<button onclick="bpspat.api.selectService(document.getElementById('service').value)">Change Service by Name</button> | |||
<br> | |||
<br> | |||
<input id="number" type="text" placeholder="Dial number"/> | |||
<button onclick="bpspat.api.dialNumber(document.getElementById('number').value)">Dial</button> | |||
<br> | |||
<br> | |||
< | <div id="log">Logs...</div> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
window.bpspat.api.init("https://<tenant>.brightpattern.com"); | window.bpspat.api.init("https://<tenant>.brightpattern.com"); | ||
function log(data) { | function log(data) { | ||
let div = document.createElement("div"); | let div = document.createElement("div"); | ||
| Line 42: | Line 48: | ||
</script> | </script> | ||
</syntaxhighlight> | |||
== Example Exercise == | |||
There are many ways to style your page elements and Agent Desktop widget display. The following is provided for example purposes only. | |||
# Paste the [[5.3:Embedded-agent-desktop-sdk-specification/UseCases/Dial#Sample_Code | | |||
sample code]] into the body of your HTML file.<br /><br /> | |||
# Save and open the page in your web browser. Make sure the agent is logged in.<br /><br /> | |||
# Click '''Get State''' to see if the agent is "Ready" to handle a call. The log data will show interaction status.<br /><br /> | |||
# In the '''Service Name''' field, enter the desired service for the call, and click '''Change Service by Name'''.<br /><br /> | |||
# Enter the phone number to be dialed. If dialing another contact center user, enter the user's extension number (e.g., "1020").<br /><br />[[File:Call-Service3-53.PNG|350px|center|Enter service name and phone number or extension]]<br /><br /> | |||
# Click '''Dial Number''' to initiate a call. The number will be dialed, even if the agent was in the "Not ready" state.<br /><br />[[File:Call-Service2-53.PNG|800px|center|The call was accepted]] | |||
Revision as of 22:50, 26 March 2019
<translate>
Call Someone on Specific Service
You can use the dialNumber method to dial a phone number and initiate a call for a logged-in agent.
Using dialNumber alongside selectService provides added control over a call. When used together, you can select the service to be used. The getState method retrieves agent state and interaction information in the logs.
Methods can be attached to web elements, such as buttons, on your webpage. When clicked, the buttons will process the API methods. Add fields to enter the phone number to be dialed and the name of the service to use.
In this article, you will learn how to:
- Attach getState, dialNumber, and selectService to buttons
- Add fields
- Place sample JavaScript into HTML
Sample Code
In this sample code, the methods are attached to button elements.
Copy this sample code for pasting into your HTML file. This is the bare minimum that you need for the SDK to work. Make sure you replace "<tenant>" with the name of your Agent Desktop web server (e.g., "example.brightpattern.com").
<script type="text/javascript" src="https://<tenant>.brightpattern.com/agentdesktop/libs/servicepattern-sdk-v1.js">
</script>
<iframe id="repeater" style="position:absolute; right: 8px; width: 300px; height: 700px;" src="https://<tenant>.brightpattern.com/agentdesktop/UniversalRepeater.jsp"></iframe>
<button onclick="bpspat.api.getState(log)">Get State</button>
<br>
<br>
<input id="service" type="text" placeholder="Service name"/>
<button onclick="bpspat.api.selectService(document.getElementById('service').value)">Change Service by Name</button>
<br>
<br>
<input id="number" type="text" placeholder="Dial number"/>
<button onclick="bpspat.api.dialNumber(document.getElementById('number').value)">Dial</button>
<br>
<br>
<div id="log">Logs...</div>
<script type="text/javascript">
window.bpspat.api.init("https://<tenant>.brightpattern.com");
function log(data) {
let div = document.createElement("div");
div.innerHTML = JSON.stringify(data);
document.getElementById("log").appendChild(div);
}
</script>
Example Exercise
There are many ways to style your page elements and Agent Desktop widget display. The following is provided for example purposes only.
- Paste the
sample code into the body of your HTML file.
- Save and open the page in your web browser. Make sure the agent is logged in.
- Click Get State to see if the agent is "Ready" to handle a call. The log data will show interaction status.
- In the Service Name field, enter the desired service for the call, and click Change Service by Name.
- Enter the phone number to be dialed. If dialing another contact center user, enter the user's extension number (e.g., "1020").
Enter service name and phone number or extension - Click Dial Number to initiate a call. The number will be dialed, even if the agent was in the "Not ready" state.
The call was accepted
</translate>