Live Chat Toolbar
  • 14 Jul 2022
  • 2 Minutes to read
  • Dark
    Light

Live Chat Toolbar

  • Dark
    Light

Article summary

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

  1. Update the chatToolbar widget

Params:

NameTypeDescription
isEnabledboolDefault value is true, if the value is true, the custom tool is available.
isHiddenboolDefault 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

  1. Register click event callback

Params:

NameTypeDescription
callbackfunctionThe 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

  1. 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:

NameTypeDescription
widthnumberSet the width of popover
heightnumberSet the height of popover

Return: No.

Example:

const client = APPClient.init();
client.set("agentconsole.livechat.toolbar.popover", {
  width: 600,
  height: 400,
});
  1. 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");
  1. Open popover for the current widget

Params: No.

Return: No.

Example:

const client = APPClient.init();
client.do("agentconsole.livechat.toolbar.popover.open");
  1. Close the popover for the current widget

Params: No.

Return: No.

Example:

const client = APPClient.init();
client.do("agentconsole.livechat.toolbar.popover.close");
  1. 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

  1. Popover opened Event

Params:

NameTypeDescription
callbackfunctionIt is triggered when Popover opened.

Return: No.

Example:

const client = APPClient.init();
client.on("agentconsole.livechat.toolbar.popover.opened", function (popover) {
  // do stuff
});
  1. Popover closed Event

Params:

NameTypeDescription
callbackfunctionIt is triggered when Popover closed.

Return: No.

Example:

const client = APPClient.init();
client.on("agentconsole.livechat.toolbar.popover.closed", function (popover) {
  // do stuff
});

Was this article helpful?