Skip to main content

Widget API Methods

The following section provides descriptions and examples of each method in the Widget API. The examples are provided to give a deeper understanding on how each method behaves. Alternative JavaScript patterns can be used at the developers discretion.

note

Methods marked as Requires Interaction require an interaction context. Any Widget leveraging these methods must be placed on an Interaction related tab (for example, Customer Details) and the interactionId must be passed to the constructor.

acceptInteraction#

AXPAXP Connect

This method accepts an alerting interaction.

This method accepts the following parameter:

  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
caution

This method only executes if the interaction's canAccept capability is set to true. Please see Capabilities for more information.

note

Requires Interaction

api.acceptInteraction();

additionalWork#

This method puts an agent into Additional Work mode.

caution

This method only executes if the canSetNotReady capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter:

  • code: the additional work code to put agent into Additional Work mode.
  • origin (optional): the target Contact Center. This parameter is mandatory if an agent has resources from multiple origins. Origin will be in string format. e.g "AXP", "ELITE"

Note: The getOrigins method returns a list of agent origin string values.

// Put agent into Additional Work mode with Additional Work Code
var code = api.getAdditionalWorkCodes()[0];
api.additionalWork(code);

completeConference#

AXP

This method completes the consult as a conference.

This method accepts the following parameter:

  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
caution

This method only executes if the interaction's canConferenceComplete capability is set to true. Please see Capabilities for more information.

note

Requires Interaction

// Complete the conference
api.completeConference();

completeTransfer#

AXP

This method transfers the interaction to the consulted address.

This method accepts the following parameter:

  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
caution

This method only executes if the interaction's canTransferComplete capability is set to true. Please see Capabilities for more information.

note

Requires Interaction

// Complete the transfer
api.completeTransfer();

consult#

AXP

This method initiates a consult to an address.

caution

This method only executes if the interaction's canConsult capability is set to true. Please see Capabilities for more information.

This method accepts the following parameters:

  • address: the address that will be used to consult.
  • uui (optional): a parameter used to update the 'User-to-User Info' while initiating a consult.
  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
  • callerLineId (optional): the address that will be defined to caller.
note

Requires Interaction. interactionId must be provided if callerLineId is defined (see example below)

// Consult an address
api.consult('3156');
// Consult an address and update the uui
api.consult('3156', 'test uui');
// Consult an address and defined callerLineId
api.consult('3156', 'test uui', 'a26109e7-53bd-420c-8891-ca5deeb37a40', '+1234');

consultToService#

AXP

This method initiates a consult to a service, services may be referred to as Queues or Skills depending on Contact Center.

caution

This method only executes if the interaction's canConsultToService capability is set to true. Please see Capabilities for more information.

This method accepts the following parameters:

  • serviceId: the ID of the service that will be used to consult.
  • uui (optional): a parameter used to update the 'User-to-User Info' while initiating a consult.
  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// Consult a service
api.consultToService('3156');
// Consult a service and update the uui
api.consultToService('3156', 'test uui');

consultToTeam#

This method initiates a consult to a team member.

caution

This method only executes if the interaction's canConsultToTeam capability is set to true. Please see Capabilities for more information.

This method accepts the following parameters:

  • address: the address that will be used to consult.
  • uui (optional): a parameter used to update the 'User-to-User Info' while initiating a consult.
  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// Consult a handle
api.consultToTeam('3156');
// Consult a handle and update the uui
api.consultToTeam('3156', 'test uui');

consultToUser#

AXP

This method initiates a consult to a user.

caution

This method only executes if the interaction's canConsultToUser capability is set to true. Please see Capabilities for more information.

This method accepts the following parameters:

  • userHandle: the userHandle that will be used to consult.
  • uui (optional): a parameter used to update the 'User-to-User Info' while initiating a consult.
  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// Consult to a userHandle
api.consultToUser('3156');
// Consult to a userHandle and update the uui
api.consultToUser('3156', 'test uui');

createCustomInteraction#

AXPAXP Connect
note

This method was createCustomCard in Workspaces 3.8 and below.

This method allows you to create work cards that will appear in the work card area in Workspaces. These custom cards appear similar to existing work cards but you can customize them so they suit your requirements on integrating Workspaces with an external work provider. These custom work cards will always be displayed below Contact Center work cards in the work card area.

Each top-level button will have an icon, title, and a type. Type will determine the button style, and is based on Neo css classes. A button can also specify a 'modifier' which will apply Neo colors to the button.

An optional 'action' property can also be added to a button to trigger a callback function when the button is clicked.

Custom cards have two options for button placement: on the work card, or in the interaction control panel above the context canvas. The buttons on the card itself are limited to one single button, typically reserved for ending an interaction. The buttons on the interaction panel are limited to 6 buttons.

Menu Limitations: for the context menu buttons, there are some limitations that you should be aware of. If you choose to configure the parent menu to have sub-menu items, there will be no search field on the parent menu. Searching on a first-level dropdown menu is only supported if the menu is configured to have no sub-menus. Searching in a sub-menu is supported. Sub-menus or first-level menus without sub-menus will display a maximum of 200 items at a time. There will be searching provided on these types of menus to further refine the list.

note

For Custom Cards to work with Customer Journey, it is required that the interactionData.state property is set to 'ACTIVE' while the card is in an active state, as Customer Journey is only initialised if this property is set to 'ACTIVE'.

note

If you are updating the timer on a card from a regular timer to a countdown timer you must make sure the following are set.

updatableTimer - for countdown timer to work, and to switch succesfully from regular to countdown, this must be set to true.

establishedTime - when the updateCustomInteraction method is called with the new card object you must reset the established time to current time (unix timestamp) e.g establishTime: new Date().getTime()

countdownTimer and countdownDuration must also be set accordingly.

This method accepts the following parameter:

  • data (required): a JavaScript Object used to configure the content, behaviour and look of the Custom Card.

The data object passed to createCustomInteraction method can contain the following properties:

ParameterTypeRequired?Description
idstringYesUnique ID of custom card
widgetIdstringYesUnique ID of custom cards widget to bind to toggles
titlestringYesTitle to display on the Custom Card and Interaction Panel
iconstringYesClass name of icon to display on Custom Card (see neo framework for possible values)
colorstringNoColor to represent Alerting card
Possible values: ['green']
All other card colors are determined by card focus in Workspaces
countdownTimerbooleanNoIs the timer a countdown timer
countdownDurationnumberNoDuration in milliseconds that the timer will count down from, if countdownTimer is set to true. Default is set to 30000 milliseconds (-00:30 second countdown)
updatableTimerbooleanRequired if you are creating a countdown timerIf timer can be restarted or not
menuTimeoutnumberNoTimeout value in milliseconds for the context menu to wait for data to be returned. Set to 8 seconds by default. Only applicable if using updateMenuItems API method
summarystringNoText to display in the interaction panel above the context canvas
establishedTimenumber (Unix timestamp)Required if displaying timerDate/Time of when Custom Card was established (displays timer)
panelButtonsbutton[]YesArray of Buttons to display in the interaction panel area above the context canvas
cardButtonsbutton[]NoArray of Buttons to display on the Custom Card
Note: Currently limited to just one button as card UX has changed.
panelButtons can be used for any other buttons required
interactionDataobjectNoObject containing card data properties Possible values: See onInteractionEvent payload in the Widget API Events section for possible object properties
isTimerDisabledbooleanNoUsed to show or hide the timer on the custom card
focusOnCreatedbooleanNoWhen set to true, the custom card will be automatically focused on creation
legTitleIconstringNoOptional icon to display below the Custom Card title
legTitleTooltipstringNoOptional text to display on hover of legTitle

A button object must be in the following format:

ParameterTypeRequiredDescription
titlestringYesText to display on hover over of button
iconstringYesClass name of icon to display for button (see neo framework for possible values)
typestringYesNeo button type to determine button style
Possible values: 'primary', 'secondary', 'tertiary'
modifierstringNoNeo button type to determine button style
Possible values: 'success', 'info', 'alert'
Default value: 'info'
Values correspond to colours green, blue and red, respectively
customInteractionIdstringNo - Property available on button callback objectCustom Interaction ID to give button access to which card button is attached to
isContextMenubooleanNoButton will be a dropdown menu and should contain menuItems
menuItemsmenuItem[]Yes if isContextMenu is trueArray of menu items to display in drop down list. Limited to 10 if subMenuItems used, otherwise limited to 200
inputWithButtonobjectNoInput with a button icon. If set, will be placed at the top of the context menu. Can be used only if isContextMenu is true.
actionfunctionNoCallback executed when button has been clicked.
Note: Action callbacks triggered when a dropdown menu is opened must include a call to updateMenuItems
positionIndexstringYesUnique index ranging from 1 to 6 used to determine position of button in the interaction panel. Button will not display unless a valid index is specified. If 2 buttons have the same index, only the first will display. As only one button is permitted on the card itself, positionIndex can be set to 1 for cardButtons.

An inputWithButton object must be in the following format:

ParameterTypeRequiredDescription
placeholderstringYesText to display as input placeholder
buttonIconstringYesIcon to display as button
buttonTooltipstringNoText to display on hover over of button icon
actionfunctionYesCallback executed when button has been clicked. Input value is passed as callback's parameter

A menuItem object must be in the following format:

ParameterTypeRequiredDescription
titlestringYesText to display on menu item
actionfunctionNoCallback executed when menu item has been clicked
subMenuItemssubMenuItem[]NoArray of subMenuItems to display in sub-menu of parent menu item. Limited to 200

A subMenuItem object must be in the following format:

ParameterTypeRequiredDescription
titlestringYesText to display on sub-menu item
actionfunctionNoCallback executed when sub-menu item has been clicked
// The following is an example of how to create a custom interaction
api.createCustomInteraction({
id: 'id',
title: 'title',
icon: 'icon',
summary: 'summary',
color: 'green',
focusOnCreated: true,
establishedTime: new Date(),
cardButtons: [{
{
title: 'end',
positionIndex: '1',
icon: 'neo-icon-end',
type: 'primary',
modifier: 'alert',
action: function (data) {
console.log('end clicked');
api.sendNotification('info', 'The button is attached to ' + data.customInteractionId);
}
}
}],
panelButtons: [{
title: 'accept',
positionIndex: '1',
icon: 'neo-icon-accept',
type: 'primary',
modifier: 'info',
action: function (data) {
console.log('accept clicked');
api.sendNotification('info', 'The button is attached to ' + data.customInteractionId);
}
},{
title: 'button-2',
positionIndex: '2',
icon: 'neo-icon-hold',
type: 'secondary',
modifier: 'alert'
},{
title: 'Menu',
icon: 'menu',
type: 'tertiary',
isContextMenu: true,
positionIndex: 3,
action: (button: CustomInteractionButton) => {
// if a context menu has an action property,
// this must only be used for calling updateMenuItems,
// otherwise remove action as property of dropdown button
this.api.updateMenuItems(this.updatedMenuItems, button);
},
menuItems: [
{
title: 'Cathal Jackson',
action: (data) => {
this.api.sendNotification(data.title + ' pressed', 'info');
},
},
{
title: 'Second Tier',
subMenuItems: [
{
title: 'James Joyce',
action: (data) => {
this.api.sendNotification(data.title + ' pressed', 'info');
},
},
],
},
]
},{
title: 'Menu Two',
icon: 'menu',
type: 'tertiary',
isContextMenu: true,
inputWithButton: {
placeholder: 'Input field',
buttonIcon: 'neo-icon-spaces',
buttonTooltip: 'My purpose here is to submit the input field value',
action: (data) => {
this.api.sendNotification(data + ' submitted', 'info');
},
},
positionIndex: 4,
menuItems: [
{
title: 'Paul Judd',
action: (data) => {
this.api.sendNotification(data.title + ' pressed', 'info');
},
},
{
title: 'Second Tier',
subMenuItems: [
{
title: 'Barry Joyce',
action: (data) => {
this.api.sendNotification(data.title + ' pressed', 'info');
},
},
],
},
]
}
],
interactionData: {
workRequestId: '23498734598723049'
}
});

createCustomStateData#

AXPAXP Connect

This method allows 3rd party developers to create custom state data. The data can be customized to display a title, color and timer, with the option to add up to 5 channel icons. The custom state data will override the existing state data displayed in the Topbar, while the channel icons will display in the Workarea in place of the existing channel icons.

Creates custom state data that will override the existing state data in Workspaces. This method accepts the following parameters:

  • data (required): A JavaScript Object used to configure the content, behaviour and look of the Custom State Data
note

Only one instance of a Custom State Data can exist in Workspaces at any given time.

The following tables outline the parameters of this method:

ParameterTypeRequired?Description
titlestringYesText to display in the status bar
colorstringNoName of color to use for the status bar. Supports green, red and grey.
timerbooleanNoSet to true to display a timer in the status bar.
reasonCodesstring[]NoList of reason codes presented when user attempted to move a channel to a Not Ready state. Limited to a max of 20 codes. Duplicates will be ignored
mandatoryCodesbooleanNoFlag to indicate if providing a reason code when moving a channel to a Not Ready state in mandatory
channelschannel[]NoThe list of channels to display. Limited to a max of 5 channels. Existing channel data will remain in place if not used.

A channel object must be in the following format:

ParameterTypeRequiredDescription
namestringYesThe name of the channel
readyIconstringYesThe icon to display when the channel is ready
notReadyIconstringYesThe icon to display when the channel is not ready
readybooleanYesState of the channel
reasonCodestringNoDisplayed as part of the icon tooltip when the channel is not ready
// Create Custom State Panel Example
api.createCustomStateData({
timer: true,
color: 'green',
title: 'Awaiting Nailup Call',
reasonCodes: ['Break', 'Lunch', 'Training'],
mandatoryCodes: true,
channels : [
{readyIcon: 'aoc-chat', notReadyIcon: 'aoc-chat-missed', ready: true, name: 'Chat'},
{readyIcon: 'aoc-email', notReadyIcon: 'aoc-email-missed', ready: false, name: 'Email', reasonCode: 'Example Reason Code'}
],
});

deleteCustomInteraction#

AXPAXP Connect
note

This method was deleteCustomCard in Workspaces 3.8 and below.

note

This method accepts the full card object as a parameter, whereas in Workspaces versions 3.8 and below, the deleteCustomCard function only accepted an id.

This method removes a custom Card from the Work Card Area in Workspaces. This method accepts the following parameter:

  • data (required): a JavaScript Object of the Custom Card.
// The following is an example of how to delete a custom interaction
const interactionToDelete = this.customInteractionCollection?
.find((interaction) => interaction.id === data.customInteractionId);
api.deleteCustomInteraction(interactionToDelete);

deleteCustomStateData#

AXPAXP Connect

Removes a custom state data from Workspaces.

api.deleteCustomStatePanel();

endConsult#

AXP

This method ends the consultative leg of an interaction.

This method accepts the following parameter:

  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// End the consult
api.endConsult();

endInteraction#

AXPAXP Connect

This method ends the active interaction.

This method accepts the following parameter:

  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
caution

This method only executes if the interaction's canEnd capability is set to true. Please see Capabilities for more information.

note

Requires Interaction

// End interaction
api.endInteraction();

finishInteraction#

AXPAXP Connect

If ACW is enabled, interactions will enter into a state of ACW after they are ended. There is a button to 'Finish' the interaction at this point, which clears the interaction from the work area. Calling this method will finish the ACW interaction.

This method accepts the following parameter:

  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
caution

This method only executes if the interaction's canCompleteACW capability is set to true. Please see Capabilities for more information.

note

Requires Interaction

// Finish ACW interaction
api.finishInteraction();

finishWork#

AXPAXP Connect

This method logs out an Agent (Does not exit Workspaces) and puts them into a Connected state.

caution

This method only executes if the canLogout capability is set to true. Please see Capabilities for more information.

// Log out agent
api.finishWork();

getAdditionalWorkCodes#

This method gets a list of all Additional Work codes if any are configured.

This method accepts the following parameter:

  • origin (optional): the target Contact Center. This parameter is mandatory if an agent has resources from multiple origins. Origin will be in string format. e.g "AXP", "ELITE"

Note: The getOrigins method returns a list of agent origin string values.

// Get all Not Ready reason codes
var workCodes = api.getAdditionalWorkCodes();

See payload of sample data which would be returned by calling api.getAdditionalWorkCodes():

Payload

[
{
"channels": [],
"code": "999",
"friendlyName": "Additional Work",
"id": "7802ba98-3ac0-4f1e-97dd-c178d1191ea2",
"state": "ACTIVE",
"type": "ADDITIONAL_WORK"
}
]

See the hello-world sample widgets for further demonstration.

getAllInteractions#

AXPAXP Connect

This method returns an array of all interactions (if any).

var interactions = api.getAllInteractions();

See payload of sample data which would be returned by calling api.getAllInteractions():

Payload

[
{
"acwDuration": "0",
"attributes": [],
"buttons": [],
"capabilities": {},
"channel": "VOICE",
"contactId": "0446fe72-acee-49a1-8e9e-34465900e0ce-dXMtY2VudHJhbDE",
"deferCode": "",
"destinationAddress": "10021",
"direction": "INCOMING",
"dispositionCode": {},
"establishedTime": "2023-09-28T15:47:44.880Z",
"externalInteractionId": "075dc598-0621-4bfb-9565-ff5a93a53846",
"id": "075dc598-0621-4bfb-9565-ff5a93a53846",
"interactionType": "CALLED",
"intrinsics": {},
"isACWEnabled": false,
"isACWExtended": false,
"isAudioMuted": false,
"isAutoAnswerEnabled": false,
"isCustomerInteraction": true,
"isMentoringInteraction": false,
"isNailUpCall": false,
"isObserved": false,
"isRecording": false,
"isTransferredToService": false,
"isTransferredToUser": false,
"isWebRtcCall": false,
"observeAction": "NONE",
"originatingAddress": "(212) 842-5599",
"participants": [],
"priority": "5",
"providerId": "e7de04a3-85c6-4046-9390-c040165b1436",
"resourceAddress": "10021",
"skill": "",
"skillId": "",
"state": "ACTIVE",
"stateChangeTime": "2023-09-28T15:47:48.168828Z",
"stateReason": "",
"tenantId": "DTTEDR",
"tenantName": "",
"topic": "Default",
"type": "[Interaction] Update",
"userToUserInfo": "",
"workCode": "",
"workRequestId": "3a2de4bc-fb4c-466a-8684-406927c13285"
},
{
"acwDuration": "0",
"attributes": [],
"buttons": [],
"capabilities": {},
"channel": "WEBCHAT",
"contactId": "7b61d925-be7b-492c-961e-c62d99dce66e",
"deferCode": "",
"destinationAddress": "10021-Chat",
"direction": "INCOMING",
"dispositionCode": {},
"establishedTime": "2023-09-28T16:17:12.373Z",
"externalInteractionId": "46d72337-e38d-4994-9e49-05dcc52e7e14",
"id": "46d72337-e38d-4994-9e49-05dcc52e7e14",
"interactionType": "CALLED",
"intrinsics": {},
"isACWEnabled": false,
"isACWExtended": false,
"isAutoAnswerEnabled": false,
"isCustomerInteraction": true,
"isMentoringInteraction": false,
"isNailUpCall": false,
"isObserved": false,
"isRecording": false,
"isTransferredToService": false,
"isTransferredToUser": false,
"isWebRtcCall": false,
"observeAction": "NONE",
"originatingAddress": "JohnDoe",
"participants": [],
"priority": "5",
"providerId": "e4c45d2f-8887-41e0-82f7-a2ac9926b7a0",
"resourceAddress": "10021-Chat",
"skill": "",
"skillId": "",
"state": "ACTIVE",
"stateChangeTime": "2023-09-28T16:17:15.970837Z",
"stateReason": "",
"tenantId": "DTTEDR",
"tenantName": "",
"topic": "Default",
"type": "[Interaction] Update",
"userToUserInfo": "",
"workCode": "",
"workRequestId": "681ff124-b829-486a-82b8-b5ca528eec30"
}
]

getBearerToken#

AXPAXP Connect

This method returns a promise that when successfully fulfilled returns a string containing an auth token with the bearer prefix. As the auth token has a short lifetime it can go stale if the Workspaces application is left idle, this method can be used by a widget to get a auth token that is not expired.

note

As this method returns a promise, add appropriate logic to handle the rejection if the operation fails.
The promise will resolve immediately if the auth token is not close (30 seconds) to expiration. If the auth token is close to expiration or has already expired, Workspaces will request a new auth token and then the promise will then resolve.
Workspaces will only make one request for a new auth token in the case of multiple calls to the getBearerToken method by an an individual widget or separate widgets.

// Get the bearer token
let bearerToken = await api.getBearerToken();

Payload

// when promise is fulfilled
'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkRIRmJwb0lVcXJZOHQyenBBMnFYZkNtcjVWTzVaRXI0UnpIVV8tZW52dlEiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOlsidXdmIl0sImV4cCI6MTcwMzA2NzYzOSwiaWF0IjoxNjcxNTMxNjM5LCJpZHAiOiJhdmF5YSIsImlzcyI6InZpcnR1YWwtdXdmLWF1dGgiLCJqdGkiOiJpZDEyMzQ1NiIsIm5iZiI6MTY3MTUzMTYzOSwicHJlZmVycmVkX3VzZXJuYW1lIjoiYWdlbnQxMEBhdmF5YS5jb20iLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiQWdlbnQiLCJTdXBlcnZpc29yIiwiUmVwb3J0aW5nX1N1cGVydmlzb3IiXX0sInN1YiI6ImFnZW50MTBAYXZheWEuY29tIiwidGVuYW50SWQiOiIxIiwidXNlclVVSUQiOiIifQ.vM-NT2cvaO89OcZLHgI4kfuu2BRLkwAb3DVmS2QAw2RGi2gwvWN7rTc9_rFXk1s3tzvVSVIKHS5xBBRlNcyx1RXCQ0sY0GLFN2jAQ46ZzMuMlpmGO3Clq_lywMhzN5MXqT-o3iRsI1k0YrDg0o0lK-5ZMUJlKkRi54BdjXEzB4bPOHbfNWB7XGP4aFGmiRTQXlCwUX8Nb96NN8vvSGtGVtFo6KLKVc-V5GkOpNEDFxOLIydKmeLW5Mx_wof2FRGJONtRM9a24dP9Fc3W3NRZCYFUlfsmvz3Auh6lYDxZRXgi4Uy0szG4HjR-ubCM9Fy3ay-S0E3WCumesygs_rWpeg'

getCapabilities#

AXPAXP Connect

This method gets the latest capabilities for the current logged in agent.

// Get all capabilities
var capabilities = api.getCapabilities();

See payload of sample data which would be returned by calling api.getCapabilities():

Payload

{
canDeactivate: false
canLogin: false
canLogout: true
canMentorChat: true
canMentorMessaging: true
canMentorSMS: true
canMentorVoice: true
canMonitorTeamMember: true
canSetAfterContactWork: true
canSetNotReady: true
canSetReady: false
canSetWorkMode: false
canSupervisorDeactivate: false
canSupervisorLogout: true
canSupervisorSetNotReady: true
canSupervisorSetReady: false
}

getClientDetails#

AXPAXP Connect
note

This method was previously named getConfiguration on 3.8 versions of Workspaces and below. We have added a new implementation of getConfiguration in 4.0 Workspaces, which returns the full configuration object that Workspaces receives on agent activation, without some of the extra fields included below.

This method returns client information relevant to the current Workspaces session for a Workspaces User. The following information is provided:

  • Agent ID.
  • Station ID.
  • Display name.
  • User first name.
  • User last name.
  • User handle.
  • Authentication token (JWT).
  • User state.
  • Channels.
  • Current locale.
  • User settings.
  • POM settings.
note

A Workspaces User is either an "Agent" or "Supervisor".

note

POM settings are only available to POM enabled Agents.

var config = api.getClientDetails();

Payload

{
"agentId": "10003",
"stationId": "1003",
"displayName": "John Costello",
"firstName": "John",
"lastName": "Costello",
"handle": "johnCostello",
"token": "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqb2huQ29zdGVsbG8iLCJpYXQiOjE1MDY1MTExOTIsImV4cCI6MTUwNjc3MDM5Mn0.eDl3y4NQfWQBeXx8R0m7uwFXE6HXdsuNr3avaBtIJhKr4pLW-9SypDIaWNtz7TI8S-VN9AtDlt6LIGiMm_l0hyPrcLTpO9EmT0GTXMOZlL45G5uork8FW_1tCujaCh8N4fgPZeXgkHcxjBTdnexxnHJ1Vqriu3n_r6J7XlmOcM5nUekIy8hItKE3Z-SsbcV7LjqG9T8oWM3nSXPYrdnWvn7i30JDQf_z4l3etBes_t_3BX1mTDhWdCMNUIBIB0qVE7SmnKqOHyyecilkHxCYWl-4v73FxTcpyLI6RGD_3Uy3EFXDo60SMr7TzctmnKlTiS4lzMFeFpe12CGQDUyuSGDQDH0n5D4wESF-Fgd8GAhvVRh1yqdwEOIxAtWDlS-7jdjwOgc9HK0jPQCnKchlwcSPNP9HJsFGks65tZbDqmYUvvfBLmEvhhWQR36ksVDnYl1-sq1yWDuQJGDzNPGrKFzgThfIkZSF2EmHI2qTOP959ZLibFx8jrBA1epK2o6-F7tJ7a5SZGWCJJDL5GWGhmGa58429zk49vUS5h01j_ajvgfNxF__MFnUvRbgOjPhEfXw4-eVEgXLe9p3FOpHdu4cKsByXL_Yew5G9NYeL9l13Wh8fokZ9OiJkhNFF7B_UboIsbbwA6gSvZ8gxWENaIm6FMGD3Hh5EZ3Uq5KZ2Uw",
"state": "READY",
"channels": {
"VOICE": {
"state": "READY",
"stateReason": "DEFAULT",
"capabilities": {
"canSetCallForwarding": true,
"canCancelCallForwarding": true,
"canStartInteraction": true,
"canStartSupervisorInteraction": true
}
},
"WEBCHAT": {
"state": "READY",
"stateReason": "DEFAULT",
"capabilities": {
"canSetCallForwarding": false,
"canCancelCallForwarding": false,
"canStartInteraction": false,
"canStartSupervisorInteraction": false
}
},
"EMAIL": {
"state": "READY",
"stateReason": "DEFAULT",
"capabilities": {
"canSetCallForwarding": false,
"canCancelCallForwarding": false,
"canStartInteraction": true,
"canStartSupervisorInteraction": false
}
},
"SMS": {
"state": "READY",
"stateReason": "DEFAULT",
"capabilities": {
"canSetCallForwarding": false,
"canCancelCallForwarding": false,
"canStartInteraction": false,
"canStartSupervisorInteraction": false
}
},
"SOCIAL": {
"state": "READY",
"stateReason": "DEFAULT",
"capabilities": {
"canSetCallForwarding": false,
"canCancelCallForwarding": false,
"canStartInteraction": false,
"canStartSupervisorInteraction": false
}
},
"VIDEO": {
"state": "READY",
"stateReason": "DEFAULT",
"capabilities": {
"canSetCallForwarding": true,
"canCancelCallForwarding": true,
"canStartInteraction": true,
"canStartSupervisorInteraction": true
}
},
"GENERIC": {
"state": "READY",
"stateReason": "DEFAULT",
"capabilities": {
"canSetCallForwarding": true,
"canCancelCallForwarding": true,
"canStartInteraction": true,
"canStartSupervisorInteraction": true
}
}
},
"locale": "en-us",
"settings": {
"aadsFQDN": "",
"aadsPort": "",
"awfosEnabled": true,
"coBrowseURL": "10.134.146.163",
"coBrowseFQDN": "10.134.146.163",
"ocpdsFQDN": "ocpdsFQDN",
"contextStoreClusterIP": "ocdsFQDN",
"ocdsFQDN": "ocdsFQDN",
"customerManagementFQDN": "10.134.146.40",
"aawgFQDN": "aawgFQDN",
"ocpAddress": "10.134.146.28",
"ocpFQDN": "10.134.146.28",
"hotdesk": false,
"isWebRTC": false,
"observeIndicatorEnabled": true,
"salesforceConfiguration": {
"ApplicationName": "CC_Client",
"ConsumerKey": "3MVG98_Psg5cppyYaaOW5FZdV8rTYZuaYxGoP4wz97OSfkLYl0EBZrXQ3B8lbWPqs5NAcPAOi5rPdpD4vP9nd",
"ConsumerSecretKey": "3723015645493377233",
"CRMIntegrationEnabled": "true",
"ProxyServerURL": "http://10.134.138.178:9090",
"SalesforceEndpoint": "https://eu6.salesforce.com"
},
"screenPopConfiguration": {
"DisplayInternalScreenpopWidgetFirstOnAgentAccept": "false",
"EnableScreenpopWithoutAgentprompting": "false",
"LaunchExternalScreenpopsOnAgentAccept": "false"
},
"welcomePage": "assets/pages/iframe.html",
"supervisorReportingURL": "assets/pages/iframe.html",
"workspacesLoggingEnabled": false,
"workspacesLoggingLevel": "",
"workspacesLogUploadLocation": "https://10.134.138.178:8443/upload",
"websocketsEnabled": true,
"genericChannelFriendlyName": "TestChannel",
"genericChannelIcon": "aoc-custom01",
"clockDriftMillis": 155
},
"pomSettings": {
"pomAgent": true,
"outboundVMAddress": "https://outboundVMAddress/"
}
}

getConfiguration#

AXPAXP Connect
note

This method is not the same method as getConfiguration on 3.8 versions of Workspaces and below. We have added a new implementation of getConfiguration in 4.0 Workspaces, which returns the full configuration object that Workspaces receives on agent activation. If you are looking for the old getConfiguration method, use getClientDetails method presented above.

var config = api.getConfiguration();

Payload

{
"token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IkRIRmJwb0lVcXJZOHQyenBBMnFYZkNtcjVWTzVaRXI0UnpIVV8tZW52dlEiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOlsidXdmIl0sImV4cCI6MTY1NTIwNzkyOSwiaWF0IjoxNjIzNjcxOTI5LCJpZHAiOiJhdmF5YSIsImlzcyI6InZpcnR1YWwtdXdmLWF1dGgiLCJqdGkiOiJpZDEyMzQ1NiIsIm5iZiI6MTYyMzY3MTkyOSwicHJlZmVycmVkX3VzZXJuYW1lIjoiYWdlbnQxNEBhdmF5YS5jb20iLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiQWdlbnQiLCJTdXBlcnZpc29yIl19LCJzdWIiOiJhZ2VudDE0QGF2YXlhLmNvbSIsInRlbmFudElkIjoiMSJ9.D8VJZ68s_7lKRpPbLLba0N1EkVE60-PxBBa7pbc6jRTcrkeiJFojHrS04ZzxdhDruGZWaMVpa9IxfIDyExvlqHyF0cQcQhZvGg6PYVXHUx5xml-Q_1SYg5Zdf3Npe6I3Q0iyAVIZC8pJlppG2E3faj68v04DXr5Dp6WsOmB_c_wA5CXh8tFtSPiBEW0FJpJzdgUGSRDwTsR2Msyo5R9D7sKHgKSZqIQDqrOR2dPXT_rBm2RLkc6Mh342PDlTwoLmeqrib8ch24Hbiez-EZRt1ikgH7ND0iW-PGMKVSL4JO2Xn6mcJfWpRY0RoyXDTi2KRk_OBQIVIGxI3SX-tm844Q",
"user": {
"id": "agent14",
"displayName": "agent14",
"firstName": "Agent",
"lastName": "14",
"roleId": "AGENT",
"supervisorUserId": "",
"tenantId": "0a7243dd-0261-41d3-a6af-2728d6122222",
"userHandle": "agent14",
"versionId": 0,
"analyticsRoleId": ""
},
"defaultUserProfileId": "Remote Profile Agent14",
"configuration": {
"coBrowseURL": "127.0.0.1",
"customerManagementFQDN": "127.0.0.1",
"workspacesLogUploadLocation": "/var/log/",
"workspacesLogsDownloadEnabled": true,
"workspacesLogsDataPrivacyEnabled": false,
"supervisorReportingURL": "127.0.0.1",
"aawgFQDN": "value\":\"127.0.0.1",
"aadsFQDN": "",
"aadsPort": "",
"welcomePage": "http://www.test.com",
"salesforceConfiguration": {
"ApplicationName": "CC_Client",
"CRMIntegrationEnabled": "true",
"ConsumerKey": "sameKey",
"ConsumerSecretKey": "sampelKeySecret",
"ProxyServerURL": "http://127.0.0.1",
"SalesforceEndpoint": "https://www.testsales.com"
},
"hotdesk": false,
"observeIndicatorEnabled": false,
"isWebRTC": false,
"screenPopConfiguration": {
"DisplayInternalScreenpopWidgetFirstOnAgentAccept": "true",
"EnableScreenpopWithoutAgentprompting": "false",
"LaunchExternalScreenpopsOnAgentAccept": "true"
},
"ocpAddress": "127.0.0.1",
"awfosEnabled": false,
"genericChannelFriendlyName": "Generic",
"genericChannelIcon": "Icon",
"environmentType": "AACC",
"authLogoutURL": "",
"platform": "ADF",
"groups": [],
"uxProfileId": "",
"uxProfileName": "",
"mailboxNumber": "",
"trunkAccessCode": "",
"uxWorkspacesLayoutId": "",
"customerProviderApiKey": "",
"onlineHelpURL": "https://support.test.com/"
},
"features": [
{
"type": "RAY_BAUMS_LAW",
"enabled": true,
"configuration": {
"@type": "type.googleapis.com/messages.RayBaumsLawConfiguration",
"maxLocationCount": 5
}
}
],
"userProfileDetailsList": [
{
"userProfile": {
"profileName": "Remote Profile Agent14"
},
"defaultResource": {
"id": "",
"providerId": "57f9b935-4ff2-4680-90f8-0df799e3f28d",
"address": "600015",
"displayName": "",
"resourceType": "DEFAULT",
"channelTypes": [
"VOICE"
],
"lineAppearances": 3,
"providerType": "IX_VOICE"
},
"numberResources": 4
}
],
"locations": [
{
"id": "0ce7fc78-a38f-4b17-8b5e-817d0843664a",
"externalId": "6bbe8778-5e24-409d-b6b6-54cd271fa7ax",
"label": "Tulsa Office 112",
"isDefault": false,
"userEditable": true,
"address": {
"country": "US",
"city": "Tulsa",
"state": "OK",
"postal": "73977",
"streetName": "Arlington Avenue",
"streetNumber": "2128"
},
"locationDetail": {
"type": "BUILDING",
"value": "2"
}
},
{
"id": "19641983-cd3a-4af2-a631-8cbcba4d009e",
"externalId": "6bbe8778-5e24-409d-b6b6-54cd271fa7ax",
"label": "Berkley Office 88",
"isDefault": true,
"userEditable": true,
"address": {
"country": "US",
"city": "Tulsa",
"state": "OK",
"postal": "73977",
"streetName": "Arlington Avenue",
"streetNumber": "2128"
},
"locationDetail": {
"type": "BUILDING",
"value": "2"
}
}
],
"templateGroups": [],
"layoutPreferences": [
{
"id": "a1bd8bad-f7eb-4826-8649-e16282685765",
"group": "WORKSPACES",
"key": "LibraryEnabled",
"value": "true",
"type": "SYSTEM"
},
{
"id": "8b2b8b31-f89b-4fdf-9984-7de991515e80",
"group": "WORKSPACES",
"key": "LibraryUri",
"value": "http://127.0.0.1:8888/",
"type": "SYSTEM"
}
],
"userPreferences": [],
"emailSignaturePreferences": [
{
"id": "c45b4985-e206-4d58-af91-897180ef523f",
"group": "EMAIL_SIGNATURES",
"key": "disableEmailSignature",
"value": "false",
"type": "SYSTEM"
},
{
"id": "8dbddd2c-518b-48f3-a49c-f13cc16d7443",
"group": "EMAIL_SIGNATURES",
"key": "fileTypesAllowed",
"value": ".apng,.bmp,.gif,.ico,.jpeg,.jpg,.png,.psd,.svg,.tif,.tiff,.webp",
"type": "SYSTEM"
},
{
"id": "4914b877-5c68-484e-877f-fce348939409",
"group": "EMAIL_SIGNATURES",
"key": "maxCharactersPerSignature",
"value": "500",
"type": "SYSTEM"
},
{
"id": "a7d7732a-a22c-4b12-bff8-da7d8fc70f1c",
"group": "EMAIL_SIGNATURES",
"key": "maxFileSize",
"value": "30kb",
"type": "SYSTEM"
},
{
"id": "16f08dd4-fb3e-4648-a959-68d1ebbe7917",
"group": "EMAIL_SIGNATURES",
"key": "numberImagesAllowedPerAgent",
"value": "3",
"type": "SYSTEM"
},
{
"id": "806f8a06-6cbd-4d77-9de1-a826faad6c29",
"group": "EMAIL_SIGNATURES",
"key": "numberImagesAllowedPerSignature",
"value": "2",
"type": "SYSTEM"
}
],
"authTimestamp": "2021-07-15T15:22:50.317107Z",
"clockDriftMillis": 157,
"streamServers": [],
"providerPreferences": [
{
"providerId": "57f9b935-4ff2-4680-90f8-05b799e3f28d",
"preferences": [
{
"id": "37c760cc-2fb1-4e08-b978-9b7dcf3ee647",
"group": "DEVICE_CONNECTION_DETAILS",
"key": "SIP_HOST",
"value": "test.com",
"type": "PROVIDER"
},
{
"id": "f7f8e059-cdb7-43d9-80a9-5b4f69dd4737",
"group": "DEVICE_CONNECTION_DETAILS",
"key": "SIP_PORT",
"value": "8081",
"type": "PROVIDER"
},
{
"id": "1818ce9a-929f-44ef-826e-e54ffs023a33f",
"group": "DEVICE_CONNECTION_DETAILS",
"key": "SIP_SECURE",
"value": "true",
"type": "PROVIDER"
}
]
}
]
}

getDispositionCodes#

AXP

This method gets a list of all disposition codes if any are configured. By default, this method returns all disposition codes configured for all channel types. However, you can receive a filtered list by passing a valid channelType as an argument, for example: getDispostionCodes('VOICE').

// Get all disposition codes
var dispositionCodes = api.getDispositionCodes();
// Get disposition codes for the voice channel
var dispositionCodes = api.getDispositionCodes('VOICE');
// Get disposition codes for the current channel using onInteractionEvent
api.onDataEvent('onInteractionEvent', function(data) {
scope.dispositionCodes = api.getDispositionCodes(data.channel);
});

This method accepts the following parameter:

  • channelType (optional): a [channel type - TODO Add link here]. This results in the method returning a filtered list of disposition codes which have been assigned to this channel type.

See payload of sample data which would be returned by calling api.getDispositionCodes():

Payload

[
{
"code": "5645",
"friendlyName": "Report to Supervisor",
"type": "DISPOSITION",
"state": "ACTIVE",
"channels": [
"SMS",
"WEBCHAT"
]
},
{
"code": "3534",
"friendlyName": "Offer discount on next call",
"type": "DISPOSITION",
"state": "ACTIVE",
"channels": [
"VOICE",
"SMS",
"EMAIL",
"WEBCHAT"
]
}
]

getInteractionCapabilities#

AXPAXP Connect

This method gets the latest capabilities for the current interaction.

note

Requires Interaction

// Get interaction capabilities
var capabilities = api.getInteractionCapabilities();

See payload of sample data which would be returned by calling api.getInteractionCapabilities():

Payload

{
"canAccept": false,
"canAddAttachment": false,
"canBarge": false,
"canCoach": false,
"canCompleteACW": false,
"canConferenceComplete": false,
"canConsult": true,
"canConsultToService": false,
"canConsultToTeam": false,
"canConsultToUser": false,
"canDefer": false,
"canEnd": true,
"canExtendACW": false,
"canForward": false,
"canHold": true,
"canIgnore": false,
"canMute": false,
"canObserve": true,
"canReject": false,
"canReply": false,
"canSendDtmf": true,
"canSendMessage": false,
"canSetACW": false,
"canSetDispositionCode": false,
"canSetUui": false,
"canSetWorkCode": true,
"canSingleStepConference": true,
"canSingleStepTransfer": true,
"canSingleStepTransferToService": false,
"canSingleStepTransferToTeam": false,
"canSingleStepTransferToUser": false,
"canTransferComplete": false,
"canUnhold": false,
"canUnmute": false
}

getInteractionData#

AXPAXP Connect

This method returns the interaction related data (same as what you get using onInteractionEvent).

note

Requires Interaction

// Best to use on your widget initialization
var data = api.getInteractionData();

See payload of sample data which would be returned by calling api.getInteractionData():

Payload

{
"id": "41dab206-b62f-44a6-a37d-4dd0f4be02ba",
"contactId": "5b733d3e-7ffb-478b-90bd-bbbe12028b8b",
"channel": "VOICE",
"state": "ACTIVE",
"capabilities": {
"canAccept": false,
"canBarge": false,
"canCoach": false,
"canCompleteACW": false,
"canConferenceComplete": false,
"canConsult": true,
"canConsultToService": false,
"canConsultToUser": false,
"canDefer": false,
"canEnd": true,
"canExtendACW": false,
"canForward": false,
"canHold": true,
"canIgnore": false,
"canMute": false,
"canObserve": true,
"canReject": false,
"canReply": false,
"canSendDtmf": true,
"canSendMessage": false,
"canSetACW": false,
"canSetDispositionCode": false,
"canSetUui": false,
"canSetWorkCode": true,
"canSingleStepConference": true,
"canSingleStepTransfer": true,
"canSingleStepTransferToService": false,
"canSingleStepTransferToUser": false,
"canTransferComplete": false,
"canUnhold": false,
"canUnmute": false
},
"workRequestId": "05fb19c2-9376-4603-ba28-fe8c01ab49d1",
"originatingAddress": "600003",
"destinationAddress": "112",
"direction": "OUTGOING",
"isCustomerInteraction": false,
"workCode": "",
"dispositionCode": {
"code": "",
"name": "",
"agentId": "",
"agentName": ""
},
"deferCode": "",
"participants": [
{
"type": "AGENT",
"subtype": "",
"name": "Tessie Corkery",
"address": "600003",
"isSelf": true,
"muted": false
},
{
"type": "AGENT",
"subtype": "",
"name": "Vicky Cassin",
"address": "112",
"isSelf": false,
"muted": false
}
],
"userToUserInfo": "",
"isNailUpCall": false,
"isWebRtcCall": false,
"isACWEnabled": false,
"isACWExtended": false,
"isAutoAnswerEnabled": false,
"topic": "Vdp Lwb",
"establishedTime": "2022-08-19T14:36:43.835413485Z",
"stateChangeTime": "2022-08-19T14:36:44.062265Z",
"acwDuration": "0",
"externalInteractionId": "41dab206-b62f-44a6-a37d-4dd0f4be02ba",
"interactionType": "CALLING",
"observeAction": "NONE",
"priority": "5",
"attributes": [
"Language.English",
"Department.CreditCard",
"Location.Ireland"
],
"stateReason": "",
"isObserved": false,
"isTransferredToService": false,
"isTransferredToUser": false,
"skill": "",
"skillId": "",
"intrinsics": {
"CALLER_NAME": "Johathan Bogisich",
"CALLER_NUMBER": "600003",
"ENGAGEMENT_PARAMETERS": "{\"customerID\":\"12345\",\"accountType\":\"Premium\", \"sourcePage\":\"homepage\"}",
"PROMPTED_DIGITS": "5469",
"START_DATE": "2022-08-19",
"START_TIME": "14:36:43",
"TOPIC_ID": "407",
"UUI": "05fb19c2-9376-4603-ba28-fe8c01ab49d1"
},
"tenantId": "1",
"tenantName": "",
"providerId": "e414ec83-ab2f-4e99-b1cd-8147073c381a",
"resourceAddress": "600003",
"isMentoringInteraction": false,
}

getInteractionId#

AXPAXP Connect

This method returns the Interaction ID for the active interaction.

note

Requires Interaction

// Returns the interaction ID as string, e.g. fbeca6e2-2b8c-45e6-bc54-55e2b96799b7
var id = api.getInteractionId();

getInteractionServices#

AXPAXP Connect

This method gets the services for the current interaction, services may be referred to as Queues or Skills depending on Contact Center.

note

Requires Interaction This method returns a promise, add appropriate logic to handle the rejection if the operation fails.

// returns array of services for an interaction
var services = await api.getInteractionServices();

See payload of sample data which would be returned by calling api.getInteractionServices():

Payload

[{
"id": "96c4b1ee-4e45-4328-aad3-9ad035b3e0c4",
"name": "Billing",
"channel_type": 9,
"provider_id": "56580630-1bb5-4393-a9cf-eae37edd8727"
},
{
"id": "c7280459-3216-4dfb-85a8-d222bb55d13d",
"name": "Support",
"channel_type": 9,
"provider_id": "56580630-1bb5-4393-a9cf-eae37edd8727"
},
{
"id": "e9568599-87d2-49a6-bb1a-dde4fbbc53f7",
"name": "Accounts",
"channel_type": 9,
"provider_id": "56580630-1bb5-4393-a9cf-eae37edd8727"
}]

getDrafts#

AXP

This method will return the last saved draft for the current email interaction.

note

Requires Interaction

note

Only applicable for Email channel

// returns an array of drafts for an interaction. Currently only a single draft per work request ID is supported.
var drafts = api.getDrafts();

See payload of sample data which would be returned by calling api.getDrafts():

Payload

[
{
"draftId": "186ab991-f9fe-4758-8e70-7aa2e0b51fdd",
"engagementId": "b6be24ad-7fda-430c-b493-bd9a63c6fa77",
"dialogId": "ba4cc490-90b6-4a02-9fab-12ccb66ee974",
"parentMessageId": "62e82a7b-b012-49f8-9116-673021dfb130",
"channelProviderId": "c792cf93-b0aa-421e-a49f-c09d934a25f3",
"channelId": "Email",
"body": {
"elementType": "text",
"elementText": {
"text": "Hello there!",
"textFormat": "PLAINTEXT"
}
},
"headers": {
"sensitivity": "PUBLIC",
"encoding": "HTML",
"subject": "RE: Sample Subject!",
"from": "sample@test.com",
"to": [
"test@avaya.com"
],
"cc": [],
"bcc": [],
"replyTo": "test@avaya.com",
"providerTimestamp": "2024-04-15T15:22:13.761Z"
},
"attachments": [
{
"attachmentId": "e78354fd-fb3b-11ee-a611-a77a4173ac95",
"name": "service.yaml",
"size": 1200,
"contentType": "application/x-yaml",
"url": "sample-url.com"
}
],
"customData": {
"displayName": "Paul Ruane",
"messageType": "REPLY"
},
"messageType": "REPLY",
"lastUpdatedBy": "fc854183-eb99-4128-ba13-22763fd31716",
"lastUpdatedAt": "2024-04-15T15:22:15.091Z"
}]

saveDraft#

AXP

This method will save current draft to a particular interaction

note

Requires Interaction

note

Only applicable for Email channel

This method accepts the following parameters:

  • interaction: The interaction object. Pass the interaction that you want to save the draft to.
  • draft: The draft object.
// saves draft object to the interaction
var interaction = api.getInteractionData();
//component code here to handle getting and saving drafts
api.saveDraft(interaction, draft);

See above getDrafts method for an example of a draft object

deleteDraft#

AXP

This method will delete current draft for a particular interaction

note

Requires Interaction

note

Only applicable for Email channel

This method accepts the following parameters:

  • id: The ID of the interaction.
// deletes draft from the interaction
var interaction = api.getInteractionData();
api.deleteDraft(interaction.id);

getLocale#

AXPAXP Connect

This method returns the current locale. See the list of supported languages in Localisation section.

// returns current locale, e.g. 'fr', 'de' etc.
var currentLocale = api.getLocale();

getMetadata#

AXPAXP Connect

This method will return back a widget's json metadata

// Get widget's metadata
var widgetMetadata = api.getMetadata("my-sample-widget");

This method accepts the following parameter:

  • element: the element name of the widget. e.g if the element of the widget is <my-sample-widget></my-sample-widget>, you would pass in the string 'my-sample-widget'

See payload of sample data which would be returned by calling api.getMetadata("my-sample-widget"):

Payload

{
"name": "My Sample Widget",
"description": "sample widget",
"tags": [],
"version": "10.0,
"id": "12345",
"icon": "neo-icon-home",
"element": "<my-sample-widget></my-sample-widget>",
"files": [
"my-sample-widget/my-sample.widget.js"
],
"overrideUrl": "https://hosted-widget-url",
"isPomWidget": true
}

getNotReadyReasonCodes#

AXPAXP Connect

This method gets a list of all Not Ready reason codes if any are configured.

This method accepts the following parameter:

  • origin (optional): the target Contact Center. This parameter is mandatory if an agent has resources from multiple origins. Origin will be in string format. e.g "AXP", "ELITE"

Note: The getOrigins method returns a list of agent origin string values.

// Get all Not Ready reason codes
var notReadyReasonCodes = api.getNotReadyReasonCodes();

See payload of sample data which would be returned by calling api.getNotReadyReasonCodes():

Payload

[
{
"code": "1234",
"friendlyName": "Bathroom",
"type": "NOT_READY",
"id": "1f43eca1-9b42-47c7-9c1d-d2a905e781aa",
"state": "ACTIVE",
"channels": []
},
{
"code": "4567",
"friendlyName": "Break",
"type": "NOT_READY",
"id": "1f43eca1-9b42-47c7-9c1d-d2a905e781ad",
"state": "ACTIVE",
"channels": []
},
{
"code": "6785",
"friendlyName": "Meeting",
"type": "NOT_READY",
"id": "1f43eca1-9b42-47c7-9c1d-d2a905e781aC",
"state": "ACTIVE",
"channels": []
}
]

getOrigins#

AXPAXP Connect

This method gets a list of all Origins.

// Get a list of origins
var origins = api.getOrigins();

See payload of sample data which would be returned by calling api.getOrigins():

Payload

["AXP", "ELITE"]

getResources#

AXPAXP Connect

This method returnes an array of all acquired resources.

// Get all acquired resources
var resources = api.getResources();

Payload

[
{
"id": "8e12db85-9643-4999-84b2-eea7f565b2d7",
"channel": "VOICE",
"state": "UNKNOWN",
"stationId": "10777",
"agentId": "phobosagent12@wta.com",
"providerId": "f260787c-a3b0-4a88-866b-a6e866c15894",
"origin": "AXP",
"reasonCodes": [],
"type": "[Resource] Acquired"
},
{
"id": "825be1c1-3680-410d-a347-8bdad146c048",
"channel": "MESSAGING",
"state": "NOT_READY",
"stationId": "phobosagent12@wta.com-Messaging",
"agentId": "phobosagent12@wta.com",
"providerId": "0a91078c-dcce-41e7-875a-553f10c2755c",
"origin": "AXP",
"reasonCodes": [],
"type": "[Resource] Acquired"
},
{
"id": "b69bd8a3-6b2d-43b4-82ee-7e80553ff486",
"channel": "WEBCHAT",
"state": "NOT_READY",
"stationId": "phobosagent12@wta.com-Chat",
"agentId": "phobosagent12@wta.com",
"providerId": "ca561b71-9b22-4fe9-bd93-35d5384c1e39",
"origin": "AXP",
"reasonCodes": [],
"type": "[Resource] Acquired"
}
]

getSupportedFileTypes#

AXP

This method gets the supported file types for the current interaction for Messaging channel.

note

Requires Interaction

// returns array of supported file types for interaction's attachments
var fileTypes = api.getSupportedFileTypes();

See payload of sample data which would be returned by calling api.getSupportedFileTypes():

Payload

['.aac', '.mp3']

getSystemReasonCodes#

AXP Connect

This method gets a list of all System reason codes if any are configured.

This method accepts the following parameter:

  • origin (optional): the target Contact Center. This parameter is mandatory if an agent has resources from multiple origins. Origin will be in string format. e.g "AXP", "ELITE"

Note: The getOrigins method returns a list of agent origin string values.

// Get all System reason codes
var systemCodes = api.getSystemReasonCodes();

See payload of sample data which would be returned by calling api.getSystemReasonCodes():

Payload

[
{
"code": "5678",
"friendlyName": "Set not ready by CC",
"type": "SYSTEM",
"id": "1f43eca1-9b42-47c7-9c1d-d2a905e781aa",
"state": "ACTIVE",
"channels": []
}
]

getTeamData#

AXP

This method returns the current agent's team data

api.getTeamData();
{
"team": [
{
"address": "600007",
"capabilities": {},
"channels": [],
"deferredInteractions": [],
"disconnectedTime": null,
"displayName": "agent6",
"firstName": "Agent",
"groups": [],
"interactions": [],
"isConnected": false,
"isMonitored": false,
"isNew": false,
"isSelf": false,
"lastName": "6",
"lastStateChangeTime": undefined,
"originStates": {},
"resourceAddress": "",
"state": "UNKNOWN",
"stateReason": "",
"type": "AGENT",
"userHandle": "agent6"
},
{
"address": "600002",
"capabilities": {},
"channels": [],
"deferredInteractions": [],
"disconnectedTime": null,
"displayName": "agent1",
"firstName": "Agent",
"groups": [],
"interactions": [],
"isConnected": false,
"isMonitored": false,
"isNew": false,
"isSelf": false,
"lastName": "1",
"lastStateChangeTime": undefined,
"originStates": {},
"resourceAddress": "",
"state": "UNKNOWN",
"stateReason": "",
"type": "SUPERVISOR",
"userHandle": "agent1"
},
{
"address": "600004",
"capabilities": {},
"channels": [],
"deferredInteractions": [],
"disconnectedTime": null,
"displayName": "agent3",
"firstName": "Agent",
"groups": [],
"interactions": [],
"isConnected": false,
"isMonitored": false,
"isNew": false,
"isSelf": false,
"lastName": "3",
"lastStateChangeTime": undefined,
"originStates": {},
"resourceAddress": "",
"state": "UNKNOWN",
"stateReason": "",
"type": "AGENT",
"userHandle": "agent3"
}
],
"supervisors": [
{
"address": "600002",
"capabilities": {},
"channels": [],
"deferredInteractions": [],
"disconnectedTime": null,
"displayName": "agent1",
"firstName": "Agent",
"groups": [],
"interactions": [],
"isConnected": false,
"isMonitored": false,
"isNew": false,
"isSelf": false,
"lastName": "1",
"lastStateChangeTime": undefined,
"originStates": {},
"resourceAddress": "",
"state": "UNKNOWN",
"stateReason": "",
"type": "SUPERVISOR",
"userHandle": "agent1"
}
]
}

getWorkCardCount#

AXPAXP Connect

This method returns the number of interactions.

// Returns interaction count as a number, e.g. 2
var interactionCount = api.getWorkCardCount();

getWorkCodes#

AXP Connect

This method gets a list of all work codes if any are configured. By default, this method returns all work codes configured for all channel types. However, you can receive a filtered list by passing a valid channelType as an argument, for example: getWorkCodes('VOICE').

// Get all work codes
var workCodes = api.getWorkCodes();
// Get work codes for the voice channel
var workCodes = api.getWorkCodes('VOICE');
// Get work codes for the current channel using onInteractionEvent
api.onDataEvent('onInteractionEvent', function(data) {
scope.workCodes = api.getWorkCodes(data.channel);
});

This method accepts the following parameter:

  • channelType (optional): a [channel type - TODO Add link here]. This results in the method returning a filtered list of work codes which have been assigned to this channel type.

See payload of sample data which would be returned by calling api.getWorkCodes():

Payload

[
{
"code": "7277",
"friendlyName": "Breakfast",
"type": "WORK",
"id": "1f43eca1-9b42-47c7-9c1d-d2a905e7812a",
"state": "ACTIVE",
"channels": [
"VOICE"
]
},
{
"code": "7777",
"friendlyName": "Sales",
"type": "WORK",
"id": "1f43eca1-9b42-47c7-9c1d-d2a905e7833a",
"state": "ACTIVE",
"channels": [
"VOICE",
"SMS",
"EMAIL",
"WEBCHAT"
]
},
{
"code": "8888",
"friendlyName": "Support",
"type": "WORK",
"id": "1f43eca1-9b42-47c7-9c1d-d2a905e781ba",
"state": "ACTIVE",
"channels": [
"EMAIL"
]
}
]

holdInteraction#

AXPAXP Connect

This method holds an active interaction.

This method accepts the following parameter:

  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
caution

This method only executes if the interaction's canHold capability is set to true. Please see Capabilities for more information.

note

Requires Interaction

// Hold interaction
api.holdInteraction();

insertMessageResponse#

AXP

This method inserts a text message into the input chat area without sending the message. This is to allow agents to edit the message prior to sending.

note

Requires Interaction

This method accepts the following parameter:

  • message: the message text.
// Inserts message into the input chat area for editing
api.insertMessageResponse('Test message');

insertSocialTemplate#

AXP

This method inserts a Social template into the input chat area without sending the message. This is to allow agents to preview/edit the template message prior to sending.

note

Requires Interaction

This method accepts the following parameter:

  • response: SocialTemplate
ParameterTypeRequired?Description
templateIdstringYesUnique template id
namestringYesName of the template
descriptionstringNoDescription of the template
publishedbooleanNoIs the provided template published
sourceTypestringYesSource type of the template
providerTemplateIdnumberYesProvider template id
providerAccountIdstringNoProvider account id
templatePropertiesRecord<string, string>NoTemplate properties
payloadstringYesPayload of the template
Sample input payload
{
"name": "visitus",
"description": "Automation Template Description",
"published": true,
"providerTemplateId": "268933449157729",
"providerAccountId": "103532829464604",
"sourceType": "whatsapp",
"templateProperties": {
"category": "MARKETING",
"language": "en_US"
},
"templateId": "69fa8c97-6498-377e-8b98-5e7237b48fac",
"payload": [
{
"text": "Sorry to see you go! Let’s hope this break won’t last long. Meanwhile, would you share your experience with us by taking a quick survey? Follow the link to help us improve. Visit at Avaya.",
"type": "BODY"
},
{
"type": "BUTTONS",
"buttons": [
{
"url": "https://www.google.com/",
"text": "Survey Link",
"type": "URL"
}
]
}
]
}
// Inserts Social template into the input chat area for editing
api.insertSocialTemplate(response);

isWidgetActive#

AXPAXP Connect

This methods checks if a widget is active.

// Get widget visibility state
var isWidgetActive = api.isWidgetActive('widget-id');

This method accepts the following parameter:

  • widgetId: The ID of the widget.

onDataEvent#

AXPAXP Connect

This method allows the widget to subscribe to the various data events delivered by Workspaces. See the Widget API Events section for the list of currently supported events.

This method accepts the following parameters:

  • event: the name of the event you want to subscribe to.
  • callback: a callback function which is fired once the event returns data.
api.onDataEvent('onInteractionEvent', function (data) {
// Do something with the event data
console.log(data);
});

removeAllDataEvents#

AXPAXP Connect

This method allows the widget to unsubscribe from all data events

api.removeAllDataEvents();

removeDataEvent#

AXPAXP Connect

This method allows the widget to unsubscribe from a specific data event

This method accepts the following parameters:

  • eventName: the name of the event you want to remove.
api.removeDataEvent('onInteractionEvent');

removeEmailAttachment#

AXP

This method removes an email attachment by attachment id.

This method accepts the following parameter:

  • attachment: the data object.

The attachment object passed to removeEmailAttachment method can contain the following properties:

ParameterTypeRequired?Description
idstringYesid of Attachment (in attachment object, field 'partId', like '7C1CA22F-B572-4FF5-9DF6-01C4370C7E3D')
// Using a emailData object (multicast)
api.removeEmailAttachment({ id: '7C1CA22F-B572-4FF5-9DF6-01C4370C7E3D' });

reportChatTyping#

This method sends a typing notification to other participants.

note

Requires Interaction

note

This method is restricted to be invoked no more than once per 6 seconds due to security restrictions.

note

In order to prevent "is typing..." label flickering on side of customer, make sure to invoke this method once per 6 seconds during user is typing.

// Define api.reportChatTyping throttle (best to use!) wrapper
var reportChatTypingThrottle = _.throttle(api.reportChatTyping, 6000, {leading: true, trailing: false});
// Listen to keydown event on input and call reportChatTypingThrottle each time user presses any key
document.querySelector('input[type=text]').addEventListener('keydown', reportChatTypingThrottle);

sendChatMessage#

AXP

This method sends a text message into an interaction on behalf of current agent.

caution

This method only executes if the interaction's canSendMessage capability is set to true. Please see Capabilities for more information.

note

Requires Interaction

note

This method is restricted to be invoked no more than once per 1 second due to security restrictions.

This method accepts the following parameter:

  • message: the message text.
// Send a message to customer from current agent
api.sendChatMessage('Test message');

sendDtmf#

AXPAXP Connect

This method sends a DTMF digit.

caution

This method only executes if the interaction's canSendDtmf capability is set to true. Please see Capabilities for more information.

This method accepts the following parameters:

  • digit: a DTMF digit to be sent. Only values 0-9, *, and # are accepted.
  • interactionId (optional): the id of the interaction. If this is not passed, the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// Send a dtmf digit
api.sendDtmf('1');

sendEmailMessage#

AXP

This method sends a text message into an interaction on behalf of current agent.

caution

This method only executes if the interaction's canSendMessage capability is set to true. Please see Capabilities for more information.

note

Requires Interaction

note

This method is restricted to be invoked no more than once per 1 second due to security restrictions.

This method accepts the following parameters:

  • emailData: the data object.
  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.

The emailData object passed to sendEmailMessage method can contain the following properties:

ParameterTypeRequired?Description
toarray of stringsYesLetter recipient
messagestringYesBody of email message
fromstringNoMail sender
subjectstringNoSubject of email
ccarray of stringsNoCarbon copy
bccarray of stringsNoBlind carbon copy
// Using a emailData object (multicast)
api.sendEmailMessage({to: ['user1@example.com'], message: 'Test message'});

sendMessage#

AXPAXP Connect

This method broadcasts a data event to all the widgets under the same interaction context. You can use this method for widget-to-widget communication and for data exchange.

This method accepts the following parameters:

  • data: text string or data object.
  • id (optional): id of a specific widget to send data to.
note

This data gets broadcast on the onMessageEvent. For details see Widget API Events.

// Using a text string (multicast)
api.sendMessage('Hello there!');
// Using a data object (multicast)
api.sendMessage({ name: 'Joe Doe', age: 32 });
// Send the message using the ID string 'unique-random-id' (unicast)
api.sendMessage({ account: 'ACC-8437' }, 'unique-random-id');

sendMessageToAnyWidget#

AXPAXP Connect

This method broadcasts a data event to any widgets, not limited to widgets in the same interaction context. You can use this method for widget-to-widget communication and for data exchange.

This method accepts the following parameters:

  • data: text string or data object.
  • id (optional): id of a specific widget to send data to.
note

This data gets broadcast on the onMessageEvent. For details see Widget API Events.

// Using a text string (multicast)
api.sendMessageToAnyWidget('Hello there!');
// Using a data object (multicast)
api.sendMessageToAnyWidget({ name: 'Joe Doe', age: 32 });
// Send the message using the ID string 'unique-random-id' (unicast)
api.sendMessageToAnyWidget({ account: 'ACC-8437' }, 'unique-random-id');

sendNotification#

AXPAXP Connect

This method displays a notification message in Workspaces. This method sends and displays the message as a "toast" notification.

This method accepts the following parameters:

  • message: text string representing the notification.
  • level: type of message (info, warning, error).
api.sendNotification('This is a sample notification.', 'info');

sendRichMediaMessage#

This method sends a rich media message into an interaction on behalf of current agent.

This method only executes if the interaction's canSendMessage capability is set to true. Please see Capabilities for more information.

note

Requires a Messaging channel interaction, otherwise the function will silently fail.

note

Valid arguments are expected, otherwise the function will silently fail. Use validateRichMediaMessage method for the media and type validation.

note

This method is restricted to be invoked no more than once per 1 second due to security restrictions.

This method accepts the following parameters:

  • media: the rich media structure object.
  • richMessageType: the type of rich media message.
  • errorCallback: optional, callback function in case of error.

Depending on the richMessageType, the rich media message object can have the following structure:

"text" richMessageType
note

Inbound and outbound messages.

// Send a rich media message to customer from current agent
api.sendRichMediaMessage({text: 'Test message'}, 'text', // text property is required
(errorType) => { // callback is optional
console.log('Error:', errorType); // perform any action
});
"image" richMessageType
note

Inbound and outbound messages.

api.sendRichMediaMessage({
name: 'imagefilename', // name is optional, as long as image file extension is specified in the mediaUrl, if not, provide it using this property
mediaUrl: 'http://example.com/image.png', // mediaUrl property is required
text: 'Optional text message' // text is optional
}, 'image',
(errorType) => { // callback is optional
console.log('Error:', errorType); // perform any action
});
"location" richMessageType
note

Inbound and outbound messages.

api.sendRichMediaMessage({
coordinates: { // coordinates property is required
lat: 37.398405, // lat property is required
long: -121.977458 // long property is required
},
location: { // optional location property
address: 'Full addreess', // optional address property
name: 'Title of address'// optional name property
}
}, 'location',
(errorType) => { // callback is optional
console.log('Error:', errorType); // perform any action
});
'locationRequest' action
api.sendRichMediaMessage({
text: 'Required text', // text is required
actions: [ // actions is optional
{
text: 'Text', // text property is required
type: 'locationRequest' // type property is required
}
]
}, 'text',
(errorType) => { // callback is optional
console.log('Error:', errorType); // perform any action
});
'File' richMessageType
api.sendRichMediaMessage({
name: 'Document.doc', // name is required
text: 'test.doc', // text is optional
mediaUrl: 'https://mediaURL', // mediaUrl is required
mediaType: 'application/doc', // mediaType is optional
mediaSize: 26624 // mediaSize is optional
}, 'file',
(errorType) => { // callback is optional
console.log('Error:', errorType); // perform any action
});

setAgentACW#

AXP Connect

This method puts an agent into an After Contact Work state.

note

This method relies on capabilities and will only execute if the canSetAfterContactWork capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter:

  • code (optional): the reason code to set agent after contact work.
  • origin (optional): the target Contact Center. This parameter is mandatory if an agent has resources from multiple origins. Origin will be in string format. e.g "AXP", "ELITE"

Note: The getOrigins method returns a list of agent origin string values.

// Put agent into an After Contact Work state
api.setAgentACW();

setAgentNotReady#

AXPAXP Connect

This method puts an agent into a Not Ready state with a Not Ready Reason Code.

caution

This method only executes if the canSetNotReady capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter:

  • code: the reason code to set agent not ready.
  • origin (optional): the target Contact Center. This parameter is mandatory if an agent has resources from multiple origins. Origin will be in string format. e.g "AXP", "ELITE"

Note: The getOrigins method returns a list of agent origin string values.

// Set agent Not Ready with Reason Code
var code = api.getNotReadyReasonCodes()[0];
api.setAgentNotReady(code);

setAgentReady#

AXPAXP Connect

This method puts an agent into a Ready state.

caution

This method only executes if the canSetReady capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter:

  • origin (optional): the target Contact Center. This parameter is mandatory if an agent has resources from multiple origins. Origin will be in string format. e.g "AXP", "ELITE"

Note: The getOrigins method returns a list of agent origin string values.

// Put agent into a Ready state
api.setAgentReady();

setDispositionCode#

AXP

This method sets a disposition code on the interaction.

caution

This method only executes if the interaction's canSetDispositionCode capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter:

  • code: the disposition code to set.
note

Requires Interaction

// Set a disposition code
api.setDispositionCode('7764');

setFocus#

AXPAXP Connect

This method sets focus on interaction. This method accepts the following parameter:

  • interactionId: id of interaction that should be focused.
// Set focus on interaction
api.setFocus(interactionId);

singleStepConference#

This method performs a single step conference to a service.

caution

This method only executes if the interaction's canSingleStepConference capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter:

  • address: the address that will be used to conference to.
  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// Single step conference to an address
api.singleStepConference('3156');

singleStepConferenceToService#

This method performs a single step conference to an address, services may be referred to as Queues or Skills depending on Contact Center.

caution

This method only executes if the interaction's canSinglStepConferenceToService capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter:

  • serviceId: the ID of the service that will be used to conference.
  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// Single step conference to a service
api.singleStepConferenceToService('3156');

singleStepConferenceToTeam#

This method performs a single step conference to a team member.

caution

This method only executes if the interaction's canSingleStepConferenceToTeam capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter: ** address: the address that will be used to conference.

  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// Single step conference to a team member
api.singleStepConferenceToTeam('3156');

singleStepConferenceToUser#

This method performs a single step conference to a user.

caution

This method only executes if the interaction's interaction's canSingleStepConferenceToUser capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter: ** userHandle: the userHandle that will be used to conference.

  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// Single step conference to a user
api.singleStepConferenceToUser('3156');

singleStepTransfer#

AXPAXP Connect

This method performs a single step transfer to an address.

caution

This method only executes if the interaction's canSingleStepTransfer capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter:

  • address: the address that will be used to transfer to.
  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
  • callerLineId (optional): the address that will be defined to caller.
note

Requires Interaction. interactionId must be provided if callerLineId is defined (see example below)

// Single step transfer to an address
api.singleStepTransfer('3156');
// Single step transfer to an address with defined callerLineId
api.singleStepTransfer('3156', 'a26109e7-53bd-420c-8891-ca5deeb37a40', '+1234');

singleStepTransferToService#

AXP

This method performs a single step transfer to a service, services may be referred to as Queues or Skills depending on Contact Center.

caution

This method only executes if the interaction's canSinglStepTransferToService capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter:

  • serviceId: the ID of the service that will be used to transfer.
  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// Single step transfer to a service
api.singleStepTransferToService('3156');

singleStepTransferToTeam#

This method performs a single step transfer to a team member.

caution

This method only executes if the interaction's canSingleStepTransferToTeam capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter:

  • address: the address that will be used to consult.
  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// Single step transfer to a team member
api.singleStepTransferToTeam('3156');

singleStepTransferToUser#

AXPAXP Connect

This method performs a single step transfer to a user.

caution

This method only executes if the interaction's canSingleStepTransferToUser capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter: ** userHandle: the userHandle that will be used to consult.

  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
note

Requires Interaction

// Single step transfer to a user
api.singleStepTransferToUser('3156');

startVoiceInteraction#

AXPAXP Connect

This method starts an outbound voice interaction.

caution

This method only executes if the canStartVoiceInteraction capability is set to true. Please see Capabilities for more information.

This method accepts the following parameter:

  • address: the address that will be used to initiate the outbound voice interaction.
  • callerLineId (optional) the address that will be defined to caller
// Make a voice call
api.startVoiceInteraction('3156');
// Make a call with defined callerLineId
api.startVoiceInteraction('3156', '+1234');

startWork#

AXPAXP Connect

This method logs in an agent and puts them into a Ready state.

caution

This method only executes if the canLogin capability is set to true. Please see Capabilities for more information.

// Start Work
api.startWork();

startWorkNotReady#

AXPAXP Connect

This method logs in an agent and puts them into a Not Ready state.

caution

This method only executes if the canLogin capability is set to true. Please see Capabilities for more information.

// Start Work in a Not Ready state
api.startWorkNotReady();

unholdInteraction#

AXPAXP Connect

This method unholds a held interaction.

This method accepts the following parameter:

  • interactionId (optional): the id of the interaction. If this is not passed then the default id tied to the interaction is used as per normal. This is mostly used for global widgets which are on the Home layout.
caution

This method only executes if the interaction's canUnhold capability is set to true. Please see Capabilities for more information.

note

Requires Interaction

// Unhold interaction
api.unholdInteraction();

updateCustomInteraction#

AXPAXP Connect
note

This method was updateCustomCard in Workspaces 3.8 and below.

This method updates an existing custom Card that is displayed in the Work Card Area in Workspaces. This method accepts the following parameter:

  • data (required): a JavaScript Object used to configure the content, behaviour and look of the Custom Card

The data object passed to updateCustomInteraction takes a custom interaction object as defined in the createCustomInteraction method presented above. The custom interaction with an id matching the id passed to the update function will be updated with the new values passed.

// The following is an example of how to update a custom interaction
api.updateCustomInteraction({
id: 'id',
title: 'title',
icon: 'icon',
summary: 'summary',
color: 'green',
establishedTime: new Date(),
cardButtons: [{
{
title: 'end',
positionIndex: '1',
icon: 'neo-icon-end',
type: 'primary',
modifier: 'alert',
action: function (data) {
console.log('end clicked');
api.sendNotification('info', 'The button is attached to ' + data.customInteractionId);
}
}
}],
panelButtons: [{
title: 'accept',
positionIndex: '1',
icon: 'neo-icon-accept',
type: 'primary',
modifier: 'info',
action: function (data) {
console.log('accept clicked');
api.sendNotification('info', 'The button is attached to ' + data.customInteractionId);
}
},{
title: 'button-2',
positionIndex: '2',
icon: 'neo-icon-hold',
type: 'secondary',
modifier: 'alert'
},{
title: 'Menu Update',
icon: 'menu',
type: 'tertiary',
isContextMenu: true,
inputWithButton: {
placeholder: 'Input field',
buttonIcon: 'neo-icon-spaces',
buttonTooltip: 'My purpose here is to submit the input field value',
action: (data) => {
this.api.sendNotification(data + ' submitted', 'info');
},
},
positionIndex: 3,
menuItems: [
{
title: 'Paul Judd',
action: (data) => {
this.api.sendNotification(data.title + ' pressed', 'info');
},
},
{
title: 'John Judd',
action: (data) => {
this.api.sendNotification(data.title + ' pressed', 'info');
},
},
{
title: 'Second Tier',
subMenuItems: [
{
title: 'Barry Joyce',
action: (data) => {
this.api.sendNotification(data.title + ' pressed', 'info');
},
},
],
},
]
}],
interactionData: {
workRequestId: '23498734598723049'
}
});

updateCustomStateData#

AXPAXP Connect

Updates the custom state data that is being displayed in Workspaces. This method accepts the following parameters:

  • data (required): A JavaScript Object used to configure the content, behaviour and look of the Custom State Data
note

Only one instance of a Custom State Data can exist in Workspaces at any given time.

The following tables outline the parameters of this method:

ParameterTypeRequired?Description
titlestringYesText to display in the status bar
colorstringNoName of color to use for the status bar. Supports green, red and grey.
timerbooleanNoSet to true to display a timer in the status bar.
reasonCodesstring[]NoList of reason codes presented when user attempted to move a channel to a Not Ready state. Limited to a max of 20 codes. Duplicates will be ignored
mandatoryCodesbooleanNoFlag to indicate if providing a reason code when moving a channel to a Not Ready state in mandatory
channelschannel[]NoThe list of channels to display. Limited to a max of 5 channels.Existing channel data will remain in place if not used.

A channel object must be in the following format:

ParameterTypeRequiredDescription
namestringYesThe name of the channel
readyIconstringYesThe icon to display when the channel is ready
notReadyIconstringYesThe icon to display when the channel is not ready
readybooleanYesState of the channel
reasonCodestringNoDisplayed as part of the icon tooltip when the channel is not ready
// Update Custom State Panel Example
api.updateCustomStatePanel({
timer: true,
color: 'red',
title: 'Awaiting Nailup Call',
reasonCodes: ['Break', 'Lunch', 'Training'],
mandatoryCodes: true,
channels : [
{readyIcon: 'aoc-chat', notReadyIcon: 'aoc-chat-missed', ready: true, name: 'Chat'},
{readyIcon: 'aoc-email', notReadyIcon: 'aoc-email-missed', ready: false, name: 'Email', reasonCode: 'Example Reason Code'}
],
});

updateMenuItems#

AXPAXP Connect

This method updates the menu items and submenu items contained inside a context menu button on a custom card.

caution

This method is only intended to be called from within an action callback on a button object.
Use case: Menu items to appear in the dropdown are always an up to date list as of when the menu has been opened.

Context menu buttons get returned their button object in the action callback so that the button can be passed to the updateMenuItems API function.

note

There is an 8-second timeout on this update function. If the data does not get returned from the third party widget through to the widget API within 8 seconds of the button click, the menu does not load the items and displays 'Loading of dropdown items timed out'. Note: This is configurable, and can be increased or decreased using the menuTimeout property on the custom card object. See above in the createCustomInteraction method.

This method accepts the following parameters:

  • data (required): an array of menu item JavaScript Objects used to configure the menu content.
  • button (required): the button object of the context menu button that was clicked. This object is passed as a parameter in the action callback function. See the following example of a context menu button using the updateMenuItems() method:
var data = [{
title: 'My Team',
subMenuItems: [{
title: 'Ian Power',
action: function (data) {
api.sendNotification('info', data.title + ' pressed');
}
}, {
title: 'Stephen Dunphy',
action: function (data) {
api.sendNotification('info', data.title + ' pressed');
}
}, {
title: 'Cathal Jackson',
action: function (data) {
api.sendNotification('info', data.title + ' pressed');
}
}],
},
{
title: 'Disposition Codes',
subMenuItems: [{
title: 'Callback Customer',
action: function (data) {
api.sendNotification('info', data.title + ' pressed');
}
}, {
title: 'Discount Offered',
action: function (data) {
api.sendNotification('info', data.title + ' pressed');
}
}],
}
];
//action property on context menu button object
...
title: 'Menu',
icon: 'menu',
type: 'tertiary',
isContextMenu: true,
positionIndex: 3,
action: (button: CustomInteractionButton) => {
this.api.updateMenuItems(this.updatedMenuItems, button);
}
...

The this.updatedMenuItems array of objects must be in the following format:

ParameterTypeRequiredDescription
titlestringYesText to display on menu item
actionfunctionNoCallback executed when menu item has been clicked
subMenuItemssubMenuItem[]NoArray of subMenuItems to display in sub-menu of parent menu item

A subMenuItem object must be in the following format:

ParameterTypeRequiredDescription
titlestringYesText to display on sub-menu item
actionfunctionNoCallback executed when sub-menu item has been clicked

validateRichMediaMessage#

This method validates a rich media message.

note

The following rich media types are currently accepted:

  • Text.
  • Image
  • Location.
  • File.
note

See sendRichMediaMessage for media (async message body) examples.

This method accepts the following parameters:

  • media: the rich media structure object.
  • richMessageType: the type of rich media message.
var MESSAGE_BODY = {text: 'Test message'};
var MESSAGE_TYPE = 'text';
// Returns an object containing validation information
var validationInfo = api.validateRichMediaMessage(MESSAGE_BODY, MESSAGE_TYPE);
if (validationInfo.isValid) {
api.sendRichMediaMessage(MESSAGE_BODY, MESSAGE_TYPE, 'This is a rich message');
} else {
console.log(validationInfo.isValid, validationInfo.msg, validationInfo.errorIn);
// failed as the message has an invalid format
}