Desktop JavaScript API Specification

Bright Pattern Documentation

Generated: 7/03/2022 11:05 pm
Content is available under license unless otherwise noted.

Purpose

The Bright Pattern Contact Center Desktop JavaScript API Specification describes the Desktop JavaScript API that provides access to a number of functions of the Bright Pattern Contact Center Agent Desktop application from the web pages or iFrames loaded into this application from other domains.

For general information about the Bright Pattern Contact Center Agent Desktop application, see the Agent Guide. For information about loading web pages into Agent Desktop from scenarios, see the Scenario Builder Reference Guide, section Web Screen Pop block.



Audience

This guide is intended for the IT personnel responsible for the data infrastructure of Bright Pattern Contact Center-based contact centers. Readers of this guide are expected to have expertise in web application development as well as a solid understanding of contact center operations.



General Information

The API supports a number of desktop telephony functions, including call initiation, voice and screen recording, interaction completion, and the setting of interaction dispositions and notes.

These functions are available via a global object called window.bpspat.api.

Example

window.bpspat.api.dialNumber("1234567");

Object Creation

The object is created when the script file is included in the web page loaded into the Agent Desktop application as follows:

<script type="text/javascript" src="[agent-desktop-web-server]/libs/servicepatternapi-dev.js"></script>

or

<script type="text/javascript" src="[agent-desktop-web-server]/agentdesktop/libs/servicepatternapi-dev.js"></script>

Example

<script type="text/javascript" src="https://barco.brightpattern.com/libs/servicepatternapi-dev.js"></script>

or

<script type="text/javascript" src="https://barco.brightpattern.com/agentdesktop/libs/servicepatternapi-dev.js"></script>



Dial Number

Makes a call to the specified number.

For more information, see the Bright Pattern Contact Center Agent Guide, section How to Make an Internal Call and section How to Make an Outbound Call.

Request

Syntax

dialNumber(number);

Parameters

Parameter Type Optional/Required Description Example
number String Required The number to be dialed "11234567"



Select Service

Selects the service that will be associated with subsequent call attempts (until another service is selected using this method or via Agent Desktop). If omitted or empty, subsequent call attempts will not be associated with any service.

For more information, see the Bright Pattern Contact Center Agent Guide, section How to Make an Internal Call and section How to Make an Outbound Call.

Request

Syntax

selectService(name);

Parameters

Parameter Type Optional/Required Description Example
name String Optional The name of the selected service "Voice Service"




Single-Step Transfer

Initiates a single-step (blind) transfer of the current call to the specified number.

Request

Syntax

singleStepTransfer(number);

Parameters

Parameter Type Optional/Required Description Example
number String Required The number to which the call is to be transferred 14151234567



Single-Step Conference

Initiates a single-step conference with the current party on the call and the party at the specified number.

Request

Syntax

singleStepConference(number);

Parameters

Parameter Type Optional/Required Description Example
number String Required The number for which the call is to be conferenced "16501234567"



Terminate Interaction

Unlike Complete Interaction, this method only releases the communication channel of the current interaction.

For example, if after-call work (ACW) is configured for the corresponding service, interaction processing will continue until ACW is completed.

Request

Syntax

terminateInteraction();




Set Notes

Sets the free-form notes for the current interaction to the specified string.

Request

Syntax

setNotes(notes);

Parameters

Parameter Type Optional/Required Description Example
notes String Required The interaction notes "Third time calling today."



Set Disposition

Sets the disposition for the current interaction to the value corresponding to the alphanumeric code specified for this disposition.

Request

Syntax

setDisposition(dispositionCode);

Parameters

Parameter Type Optional/Required Description Example
dispositionCode String Required The numeric code of the desired disposition "12345"




Set Disposition By Name

Sets the disposition for the current interaction by the name specified of the disposition.

Request

Syntax

setDispositionByName(name);

Parameters

Parameter Type Optional/Required Description Example
name String Required The name of the desired disposition "Product sold"




Post Variable

Enables a variable to be pushed to a scenario as if the Set Variable block is included; the variable is then available in scenarios and workflows.

Request

Syntax

postVariable(name, value);

Parameters

Parameter Type Optional/Required Description
name String Required The name of the desired variable
value String Required The resulting value of the variable




Set Reporting Custom Field

Allows custom reporting fields to be entered during an agent’s interaction with a customer; the method works like the Set Custom Reporting Field scenario block.

Request

Syntax

setReportingCustomField(name, value);

Parameters

Parameter Type Optional/Required Description Example
name String Required The name of the custom reporting field "custom1"
value String Required The resulting value of the custom reporting field "$(variable_in_field)"




Complete Interaction

Completes the current interaction.

If the interaction requires a disposition in order to be completed, Agent Desktop will show a warning message.

Request

Syntax

completeInteraction();




Complete Interaction with Disposition and Notes

Completes the current interaction and sets its disposition and notes to the specified values (i.e., combines the actions of the Set Notes, Set Disposition, and Complete Interaction methods).

Request

Syntax

completeInteractionWithDisp(dispositionCode, notes);

Parameters

Parameter Type Optional/Required Description Example
dispositionCode String Required The alphanumeric code of the desired disposition "12345"
notes String Optional The interaction notes "Could not resolve. Not enough information."



Get Call Recording Status

Requests the current status of voice recording of the current call.

Request

Syntax

getCallRecordingStatus(callback);

Parameters

Parameter Type Optional/Required Description
callback Function Required Function that will be called upon completion of the method



Start Call Recording

Starts voice recording for the current call. For more information, see the Bright Pattern Contact Center Agent Guide, section How to Record a Call.

Note that prior to Bright Pattern Contact Center version 3.8, this method was called startCurrentCallRecording(); and backward compatibility is preserved.

Request

Syntax

startCallRecording(callback);

Parameters

Parameter Type Optional/Required Description
callback Function Required Function that will be called upon completion of the method





Stop Call Recording

Stops voice recording for the current call.

Note that prior to Bright Pattern Contact Center version 3.8, this method was called stopCurrentCallRecording(); and backward compatibility is preserved.

Request

Syntax

stopCallRecording(callback);

Parameters

Parameter Type Optional/Required Description
callback Function Required Function that will be called upon completion of the method




Mute Call Recording

Mutes voice recording for the current call. Unlike Stop Call Recording, this method will continue voice recording for the current call, but any voice signal will be replaced with silence.

Request

Syntax

muteCallRecording(callback);

Parameters

Parameter Type Optional/Required Description
callback Function Required Function that will be called upon completion of the method



Unmute Call Recording

Unmutes the previously muted voice recording for the current call.

Request

Syntax

unmuteCallRecording(callback);

Parameters

Parameter Type Optional/Required Description
callback Function Required Function that will be called upon completion of the method



Get Screen Recording Status

This function requests the current status of screen recording of the user session.

Request

Syntax

getScreenRecordingStatus(callback);

Parameters

Parameter Type Optional/Required Description
callback Function Required Function that will be called upon completion of the method




Stop Screen Recording

Stops screen recording of the user session.

Request

Syntax

stopScreenRecording(callback);

Parameters

Parameter Type Optional/Required Description
callback Function Required Function that will be called upon completion of the method




Pause Screen Recording

Pauses screen recording of the user session.

For the period when screen recording is paused, the recording will contain a static snapshot of the desktop at the moment when pause was applied.

Request

Syntax

pauseScreenRecording(callback);

Parameters

Parameter Type Optional/Required Description
callback Function Required Function that will be called upon completion of the method




Resume Screen Recording

Resumes the previously paused screen recording of the user session.

Request

Syntax

resumeScreenRecording(callback);

Parameters

Parameter Type Optional/Required Description
callback Function Required Function that will be called upon completion of the method




Pause Call and Screen Recording

Mutes call recordings and screen recordings using the following commands.

Mute Call Recordings

Mutes call recording (e.g., when an agent opens a payment screen, a third-party web application loaded into Agent Desktop may issue the JavaScript command).

Note that it does not require loading API code on the application's page.

Syntax

parent.frames.postMessage('{"command": "MUTE_CALL_RECORDINGS"}', '*');


Mute Screen Recordings

Mutes screen recording (e.g., when an agent opens a payment screen, a third-party web application loaded into Agent Desktop may issue the JavaScript command).

Note that it does not require loading API code on the application's page.

Syntax

parent.frames.postMessage('{"command": "MUTE_SCREEN_RECORDINGS"}', '*');




Resume Call and Screen Recording

Uses the following commands to resume a call recording or screen recording that is currently muted.

Unmute Call Recordings

Resumes call recording (e.g., when an agent exits a payment screen, a third-party web application loaded into Agent Desktop may issue the JavaScript command).

Note that it does not require loading API code on the application's page.

Syntax

parent.frames.postMessage('{"command": "UNMUTE_CALL_RECORDINGS"}', '*');


Unmute Screen Recordings

Resumes screen recording (e.g., when an agent exits a payment screen, a third-party web application loaded into Agent Desktop may issue the Javascript command). Note that it does not require loading API code on the application's page.

Syntax

parent.frames.postMessage('{"command": "UNMUTE_SCREEN_RECORDINGS"}', '*');




Callback

The function that is called upon completion of the call/screen recording methods.

Syntax

callback = function(data) {
data.recording = 1/0;
data.muted = 1/0;
data.paused = 1/0;
}

Parameters

Parameter Type Description Example
data.recording Boolean Indicates if voice/screen recording is currently in progress; note that voice recording is applied to interactions (calls), while screen recording is applied to user sessions "1" (for true; recording is on)
data.muted Boolean Indicates if voice recording is currently muted; returned only for the voice recording methods "0" (for false; recording is not muted)
data.paused Boolean Indicates if screen recording is currently paused; returned only for the screen recording methods "1" (for false, recording is not paused)