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.
#
acceptInteractionThis 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
#
additionalWorkThis 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.
#
completeConferenceThis 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
#
completeTransferThis 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
#
consultThis 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)
#
consultToServiceThis 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
#
consultToTeamThis 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
#
consultToUserThis 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
#
createCustomInteractionnote
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:
Parameter | Type | Required? | Description |
---|---|---|---|
id | string | Yes | Unique ID of custom card |
widgetId | string | Yes | Unique ID of custom cards widget to bind to toggles |
title | string | Yes | Title to display on the Custom Card and Interaction Panel |
icon | string | Yes | Class name of icon to display on Custom Card (see neo framework for possible values) |
color | string | No | Color to represent Alerting card Possible values: ['green'] All other card colors are determined by card focus in Workspaces |
countdownTimer | boolean | No | Is the timer a countdown timer |
countdownDuration | number | No | Duration 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) |
updatableTimer | boolean | Required if you are creating a countdown timer | If timer can be restarted or not |
menuTimeout | number | No | Timeout 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 |
summary | string | No | Text to display in the interaction panel above the context canvas |
establishedTime | number (Unix timestamp) | Required if displaying timer | Date/Time of when Custom Card was established (displays timer) |
panelButtons | button[] | Yes | Array of Buttons to display in the interaction panel area above the context canvas |
cardButtons | button[] | No | Array 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 |
interactionData | object | No | Object containing card data properties Possible values: See onInteractionEvent payload in the Widget API Events section for possible object properties |
isTimerDisabled | boolean | No | Used to show or hide the timer on the custom card |
focusOnCreated | boolean | No | When set to true, the custom card will be automatically focused on creation |
legTitleIcon | string | No | Optional icon to display below the Custom Card title |
legTitleTooltip | string | No | Optional text to display on hover of legTitle |
A button object must be in the following format:
Parameter | Type | Required | Description |
---|---|---|---|
title | string | Yes | Text to display on hover over of button |
icon | string | Yes | Class name of icon to display for button (see neo framework for possible values) |
type | string | Yes | Neo button type to determine button style Possible values: 'primary', 'secondary', 'tertiary' |
modifier | string | No | Neo button type to determine button style Possible values: 'success', 'info', 'alert' Default value: 'info' Values correspond to colours green, blue and red, respectively |
customInteractionId | string | No - Property available on button callback object | Custom Interaction ID to give button access to which card button is attached to |
isContextMenu | boolean | No | Button will be a dropdown menu and should contain menuItems |
menuItems | menuItem[] | Yes if isContextMenu is true | Array of menu items to display in drop down list. Limited to 10 if subMenuItems used, otherwise limited to 200 |
inputWithButton | object | No | Input with a button icon. If set, will be placed at the top of the context menu. Can be used only if isContextMenu is true. |
action | function | No | Callback executed when button has been clicked. Note: Action callbacks triggered when a dropdown menu is opened must include a call to updateMenuItems |
positionIndex | string | Yes | Unique 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:
Parameter | Type | Required | Description |
---|---|---|---|
placeholder | string | Yes | Text to display as input placeholder |
buttonIcon | string | Yes | Icon to display as button |
buttonTooltip | string | No | Text to display on hover over of button icon |
action | function | Yes | Callback executed when button has been clicked. Input value is passed as callback's parameter |
A menuItem object must be in the following format:
Parameter | Type | Required | Description |
---|---|---|---|
title | string | Yes | Text to display on menu item |
action | function | No | Callback executed when menu item has been clicked |
subMenuItems | subMenuItem[] | No | Array of subMenuItems to display in sub-menu of parent menu item. Limited to 200 |
A subMenuItem object must be in the following format:
Parameter | Type | Required | Description |
---|---|---|---|
title | string | Yes | Text to display on sub-menu item |
action | function | No | Callback executed when sub-menu item has been clicked |
#
createCustomStateDataThis 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:
Parameter | Type | Required? | Description |
---|---|---|---|
title | string | Yes | Text to display in the status bar |
color | string | No | Name of color to use for the status bar. Supports green, red and grey. |
timer | boolean | No | Set to true to display a timer in the status bar. |
reasonCodes | string[] | No | List 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 |
mandatoryCodes | boolean | No | Flag to indicate if providing a reason code when moving a channel to a Not Ready state in mandatory |
channels | channel[] | No | The 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:
Parameter | Type | Required | Description |
---|---|---|---|
name | string | Yes | The name of the channel |
readyIcon | string | Yes | The icon to display when the channel is ready |
notReadyIcon | string | Yes | The icon to display when the channel is not ready |
ready | boolean | Yes | State of the channel |
reasonCode | string | No | Displayed as part of the icon tooltip when the channel is not ready |
#
deleteCustomInteractionnote
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.
#
deleteCustomStateDataRemoves a custom state data from Workspaces.
#
endConsultThis 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
#
endInteractionThis 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
#
finishInteractionIf 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
#
finishWorkThis 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.
#
getAdditionalWorkCodesThis 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.
See payload of sample data which would be returned by calling api.getAdditionalWorkCodes()
:
Payload
See the hello-world sample widgets for further demonstration.
#
getAllInteractionsThis method returns an array of all interactions (if any).
See payload of sample data which would be returned by calling api.getAllInteractions()
:
Payload
#
getBearerTokenThis 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.
Payload
#
getCapabilitiesThis method gets the latest capabilities for the current logged in agent.
See payload of sample data which would be returned by calling api.getCapabilities()
:
Payload
#
getClientDetailsnote
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.
Payload
#
getConfigurationnote
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.
Payload
#
getDispositionCodesThis 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').
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
#
getInteractionCapabilitiesThis method gets the latest capabilities for the current interaction.
note
Requires Interaction
See payload of sample data which would be returned by calling api.getInteractionCapabilities()
:
Payload
#
getInteractionDataThis method returns the interaction related data (same as what you get using onInteractionEvent).
note
Requires Interaction
See payload of sample data which would be returned by calling api.getInteractionData()
:
Payload
#
getInteractionIdThis method returns the Interaction ID for the active interaction.
note
Requires Interaction
#
getInteractionServicesThis 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.
See payload of sample data which would be returned by calling api.getInteractionServices()
:
Payload
#
getDraftsThis method will return the last saved draft for the current email interaction.
note
Requires Interaction
note
Only applicable for Email channel
See payload of sample data which would be returned by calling api.getDrafts()
:
Payload
#
saveDraftThis 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.
See above getDrafts method for an example of a draft object
#
deleteDraftThis 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.
#
getLocaleThis method returns the current locale. See the list of supported languages in Localisation section.
#
getMetadataThis method will return back a widget's json metadata
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
#
getNotReadyReasonCodesThis 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.
See payload of sample data which would be returned by calling api.getNotReadyReasonCodes()
:
Payload
#
getOriginsThis method gets a list of all Origins.
See payload of sample data which would be returned by calling api.getOrigins()
:
Payload
#
getResourcesThis method returnes an array of all acquired resources.
Payload
#
getSupportedFileTypesThis method gets the supported file types for the current interaction for Messaging channel.
note
Requires Interaction
See payload of sample data which would be returned by calling api.getSupportedFileTypes()
:
Payload
#
getSystemReasonCodesThis 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.
See payload of sample data which would be returned by calling api.getSystemReasonCodes()
:
Payload
#
getTeamDataThis method returns the current agent's team data
#
getWorkCardCountThis method returns the number of interactions.
#
getWorkCodesThis 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').
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
#
holdInteractionThis 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
#
insertMessageResponseThis 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.
#
insertSocialTemplateThis 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
Parameter | Type | Required? | Description |
---|---|---|---|
templateId | string | Yes | Unique template id |
name | string | Yes | Name of the template |
description | string | No | Description of the template |
published | boolean | No | Is the provided template published |
sourceType | string | Yes | Source type of the template |
providerTemplateId | number | Yes | Provider template id |
providerAccountId | string | No | Provider account id |
templateProperties | Record<string, string> | No | Template properties |
payload | string | Yes | Payload of the template |
#
isWidgetActiveThis methods checks if a widget is active.
This method accepts the following parameter:
- widgetId: The ID of the widget.
#
onDataEventThis 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.
#
removeAllDataEventsThis method allows the widget to unsubscribe from all data events
#
removeDataEventThis 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.
#
removeEmailAttachmentThis 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:
Parameter | Type | Required? | Description |
---|---|---|---|
id | string | Yes | id of Attachment (in attachment object, field 'partId', like '7C1CA22F-B572-4FF5-9DF6-01C4370C7E3D') |
#
reportChatTypingThis 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.
#
sendChatMessageThis 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.
#
sendDtmfThis 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
#
sendEmailMessageThis 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:
Parameter | Type | Required? | Description |
---|---|---|---|
to | array of strings | Yes | Letter recipient |
message | string | Yes | Body of email message |
from | string | No | Mail sender |
subject | string | No | Subject of email |
cc | array of strings | No | Carbon copy |
bcc | array of strings | No | Blind carbon copy |
#
sendMessageThis 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.
#
sendMessageToAnyWidgetThis 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.
#
sendNotificationThis 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).
#
sendRichMediaMessageThis 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.
"image" richMessageType
note
Inbound and outbound messages.
"location" richMessageType
note
Inbound and outbound messages.
'locationRequest' action
'File' richMessageType
#
setAgentACWThis 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.
#
setAgentNotReadyThis 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.
#
setAgentReadyThis 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.
#
setDispositionCodeThis 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
#
setFocusThis method sets focus on interaction. This method accepts the following parameter:
- interactionId: id of interaction that should be focused.
#
singleStepConferenceThis 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
#
singleStepConferenceToServiceThis 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
#
singleStepConferenceToTeamThis 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
#
singleStepConferenceToUserThis 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
#
singleStepTransferThis 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)
#
singleStepTransferToServiceThis 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
#
singleStepTransferToTeamThis 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
#
singleStepTransferToUserThis 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
#
startVoiceInteractionThis 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
#
startWorkThis 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.
#
startWorkNotReadyThis 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.
#
unholdInteractionThis 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
#
updateCustomInteractionnote
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.
#
updateCustomStateDataUpdates 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:
Parameter | Type | Required? | Description |
---|---|---|---|
title | string | Yes | Text to display in the status bar |
color | string | No | Name of color to use for the status bar. Supports green, red and grey. |
timer | boolean | No | Set to true to display a timer in the status bar. |
reasonCodes | string[] | No | List 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 |
mandatoryCodes | boolean | No | Flag to indicate if providing a reason code when moving a channel to a Not Ready state in mandatory |
channels | channel[] | No | The 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:
Parameter | Type | Required | Description |
---|---|---|---|
name | string | Yes | The name of the channel |
readyIcon | string | Yes | The icon to display when the channel is ready |
notReadyIcon | string | Yes | The icon to display when the channel is not ready |
ready | boolean | Yes | State of the channel |
reasonCode | string | No | Displayed as part of the icon tooltip when the channel is not ready |
#
updateMenuItemsThis 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:
The this.updatedMenuItems array of objects must be in the following format:
Parameter | Type | Required | Description |
---|---|---|---|
title | string | Yes | Text to display on menu item |
action | function | No | Callback executed when menu item has been clicked |
subMenuItems | subMenuItem[] | No | Array of subMenuItems to display in sub-menu of parent menu item |
A subMenuItem object must be in the following format:
Parameter | Type | Required | Description |
---|---|---|---|
title | string | Yes | Text to display on sub-menu item |
action | function | No | Callback executed when sub-menu item has been clicked |
#
validateRichMediaMessageThis 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.