Channel Service
Class finesse.digital.ChannelService
Provides methods that are leveraged by the gadgets serving digital channels to register, update, or modify digital channel-specific display information and corresponding menu action behavior in Agent State Control Menu (referred to as the FNC Menu component).
These APIs are available to the gadget through the finesse.min.js import. For more information on how to write a sample gadget, see https://github.com/CiscoDevNet/finesse-sample-code/tree/master/LearningSampleGadget.
Example
Field Details
Name |
Description |
---|---|
ICON_BADGE_TYPE |
The type of badge in the digital channel. |
ICON_TYPE |
The type of icon in the digital channel. For more information, see Cisco Common Desktop Stock Icon Names with Image. |
STATE_STATUS |
The color of the icon based on the current state of the digital channel. |
STATUS |
The operation status of the digital channel. |
Methods
addChannel(channelId, channelData, onMenuClick, onSuccess, onError)
Add a digital channel to the FNC menu component. The API requires the complete digital channel state in the form of a JSON payload. Developers must pre-validate the JSON against its corresponding schema by testing it through finesse.utilities.JsonValidator.validateJson. The result of the add operation is returned through the given success or error callback.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
channelId |
String |
Unique identifier to register the digital channel with FNC. Used in the callback for FNC. |
Yes |
channelData |
Object |
The data of the key-value pair added to the digital channel as JSON payload. The following are the channelData keys:
For more information on the channelData keys, see Digital Channel. |
Yes |
onMenuClick |
Function |
Callback function that is invoked when the menu button of the digital channel is clicked. |
Yes |
onSuccess |
Function |
Callback function that is invoked upon a successful add operation. |
Yes |
onError |
Function |
Callback function that is invoked upon an unsuccessful add operation. |
Yes |
Throws
{Error}
If the digital channelData passed on is not as per the schema.
init(ContainerServices)
Initiates the ChannelService module.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
ContainerServices |
Function |
Provides container level services for gadget developers. Gadgets can utilize the container dialogs and event handling to add or remove a service. |
Yes |
Returns
{finesse.digital.ChannelService}
The initiated finesse.digital.ChannelService reference.
removeChannel(channelId, onSuccess, onError)
Removes the previously added digital channel representation from the FNC menu component.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
channelId |
String |
Unique identifier of the digital channel to be removed. This Id is returned from the FNC. |
Yes |
onSuccess |
Function |
Callback function that is invoked upon a successful remove operation. |
Yes |
onError |
Function |
Callback function that is invoked upon an unsuccessful remove operation. |
Yes |
updateChannel(channelId, channelData, onSuccess, onError)
Updates the digital channel in the FNC menu component. None of the data that is passed within the data payload channelData is mandatory. This API provides an easy way to update the complete channel configuration in one go or partially if necessary. The result of the update operation is intimated through the given success and error callbacks.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
channelId |
String |
Unique identifier of the digital channel to be removed. This Id is returned from the FNC. |
Yes |
channelData |
Object |
The data of the key-value pair updated to the digital channel as JSON payload. For more information on the object description, see addChannel(channelId, channelData, onMenuClick, onSuccess, onError) |
Yes |
onSuccess |
Function |
Callback function that is invoked upon a successful update operation. |
Yes |
onError |
Function |
Callback function that is invoked upon an unsuccessful update operation. |
Yes |
updateChannelMenu(channelId, menuItems, onSuccess, onError)
Updates the menu displayed for the digital channel.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
channelId |
String |
Unique identifier of the digital channel to be removed. This Id is returned from the FNC. |
Yes |
menuItems |
Array |
The list of menu items for the digital channel. For more information, see menuConfig. |
Yes |
onSuccess |
Function |
Callback function that is invoked upon a successful update operation. |
Yes |
onError |
Function |
Callback function that is invoked upon an unsuccessful update operation. |
Yes |
updateChannelState(channelId, channelState, onSuccess, onError)
Updates the digital channel's current state.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
channelId |
String |
Unique identifier of the digital channel to be updated. This Id is returned from the FNC. |
Yes |
channelState |
Object |
The current state of the digital channel. For more information, see channelState. |
Yes |
onSuccess |
Function |
Callback function that is invoked upon a successful update operation. |
Yes |
onError |
Function |
Callback function that is invoked upon an unsuccessful update operation. |
Yes |