^
^

< Back to Package Overview

Agent API

Create Agent

Create an instance of the Agent API from the ClientSession object using:

var agent = clientSession.createAgent();

Retrieve Agent

Retrieve an instance of the Agent API from the ClientSession object using:

var agent = clientSession.getAgent();

Agent Properties

agent.state;    // Object listing enum types for 'ready' and 'not ready' states

Agent Methods

Activate Agent

Activate the Client Session with an Agent's default profile

agent.activate('username');

Alternatively, to activate with a specified profile

agent.activate('username', 'profileId');

Note: for v3.2.2 and before - there is only 1 profile supported in Oceana, so not passing a profileId will work as the default profile will be used by the server. If you do pass an incorrect profileId, this will render the Agent unuseable in Oceana until the UAC Snap-In has been restarted.

Alternatively, to activate with a specified profile and extension (NB: only if Hotdesking has been enabled in Oceana)

agent.activate('username', 'profileId', address);

Deactivate Agent

To deactivate an Agent's Client Session

agent.deactivate();

Login Agent

Log Agent in to Contact Center

agent.login();

An Agent will login with the pre-configured default state. The default setting can be overridden, for example with a login state of 'Not Ready'.

agent.login(agent.state.NOT_READY);

Logout Agent

Log Agent out of Contact Center.

agent.logout();

Set Agent to Go Ready

Set Agent State to "Ready" so they can now accept new work interactions.

agent.goReady();

Set Agent to Go Not Ready

Set Agent State to "Not Ready" so they do not receive new work interactions.

agent.goNotReady();

To set the Agent "Not Ready" with a Reason, use the following.

var reasonCodes = clientSession.getReasonCodes().findAllByType('NOT_READY');
agent.goNotReady(reasonCodes[0].code);

Is Agent Activated

Check if an agent's Client Session is currently activated using the following syntax.

agent.isActivated();

Listening for Agent Events

As API requests are asynchronous, it is necessary to create callbacks to listen out for events triggered

Listening for Initiated Session Event

An event listener can be attached to "listen" for the session initiated event called when a Notification session is created. This is achieved using the following syntax.

agent.addOnSessionInitialisedCallback(function () {
  console.log('Notification Session has been initiated');
});

Listening for Activate Event

An event listener can be attached to "listen" for the activate event using the following syntax.

agent.addOnActivatedCallback(function (agent) {
  console.log('Agent Client Session has been successfully activated');
});

Listening for Deactivate Event

An event listener can be attached to "listen" for the deactivate event using the following syntax.

agent.addOnDeactivatedCallback(function (agent) {
  console.log('Agent Client Session has been successfully deactivated');
});

Listening for Ready State Event

An event listener can be attached to "listen" for the go ready event using the following syntax.

agent.addOnStateReadyCallback(function (state) {
  console.log('Agent State has been successfully set to Ready');
});

Listening for Not Ready State Event

An event listener can be attached to "listen" for the go not ready event using the following syntax.

agent.addOnStateNotReadyCallback(function (state) {
  console.log('Agent State has been successfully set to Not Ready');
});

Listening for Logged Out State Event

An event listener can be attached to "listen" for the logged out event using the following syntax.

agent.addOnStateLoggedOutCallback(function (state) {
  console.log('Agent has been successfully logged out');
});   
Feedback

Your feedback has been successfully submitted.

There was a problem submitting your feedback. Please contact your product support representative.

Page Feedback