- 14 Jul 2022
- 2 Minutes to read
- Print
- DarkLight
Live Chat Toolbar
- Updated on 14 Jul 2022
- 2 Minutes to read
- Print
- DarkLight
The widget appears as an icon in the chat's editor toolbar. Clicking it opens a popover, the page you configured in the manifest will be displayed in the popover.
Example manifest:
{
"manifestVersion": "2.0",
"agentConsole": {
" widgets": {
"chatToolbar": {
"id": "custom-toolbar",
"url": "./index.html",
"tooltip": "Custom toolbar",
"icon": "./icon.png"
}
}
}
}
See more introduction.
The following additional actions are available in this widget:
How to Use API
You must invoke api through SDK, which provides different methods, such as listening to events using the on method. Which method is used to call the api? It it desided by the providor.
Learn more for SDK view here.
Actions
- Update the chatToolbar widget
Params:
Name | Type | Description |
---|---|---|
isEnabled | bool | Default value is true , if the value is true , the custom tool is available. |
isHidden | bool | Default value is false , if the value is true , the custom tool is hidden. |
Return:
No.
Example:
const client = APPClient.init();
client
.set("agentconsole.livechat.toolbar.icon", {
isEnabled: true,
isHidden: false,
})
Events
- Register click event callback
Params:
Name | Type | Description |
---|---|---|
callback | function | The callback function will be fired when clicking the extended icon. |
Return:
No.
Example:
const client = APPClient.init();
client.on("agentconsole.livechat.toolbar.icon.click", function (icon) {
// do stuff
});
Popover
Popover is not an independent object. If the widget supports popover, you can use the following APIs to operate it.
Actions
- Update Popover Info
By default, the size of the popover is 600x400, you can call following API to adjust the size base on requirements.
Params:
Name | Type | Description |
---|---|---|
width | number | Set the width of popover |
height | number | Set the height of popover |
Return:
No.
Example:
const client = APPClient.init();
client.set("agentconsole.livechat.toolbar.popover", {
width: 600,
height: 400,
});
- Toggle popover on and off for the current widget
You can use this API to toggle popover on and off.
Params:
No.
Return:
No.
Example:
const client = APPClient.init();
client.do("agentconsole.livechat.toolbar.popover.toggle");
- Open popover for the current widget
Params:
No.
Return:
No.
Example:
const client = APPClient.init();
client.do("agentconsole.livechat.toolbar.popover.open");
- Close the popover for the current widget
Params:
No.
Return:
No.
Example:
const client = APPClient.init();
client.do("agentconsole.livechat.toolbar.popover.close");
- Get status of popover opening
Params:
No.
Return:
The status of popover opening, its type is boolean.
Example:
const client = APPClient.init();
client.get("agentconsole.livechat.toolbar.popover.status");
Events
- Popover opened Event
Params:
Name | Type | Description |
---|---|---|
callback | function | It is triggered when Popover opened. |
Return:
No.
Example:
const client = APPClient.init();
client.on("agentconsole.livechat.toolbar.popover.opened", function (popover) {
// do stuff
});
- Popover closed Event
Params:
Name | Type | Description |
---|---|---|
callback | function | It is triggered when Popover closed. |
Return:
No.
Example:
const client = APPClient.init();
client.on("agentconsole.livechat.toolbar.popover.closed", function (popover) {
// do stuff
});