Search
K

JavaScript API

The Engagement Widget JavaScript API allows JavaScript code running on your site or app to interact with the Engagement Widget. The table below lists the API methods that are available on it. These JavaScript API is accessible through the window.EngagementWidget.api object:
Method
Description
Parameters
Return Type
getTools
Gets the list of active tools in the Widget
None
Array<ToolEntry>
hideWidget
Hides the widget container
None
showWidget
Unhides the widget container
None
openWidget
Opens the widget panel
None
closeWidget
Closes the widget panel
None
toggleWidget
Opens or closes the widget panel depending on whether it is closed or open
None
showWelcomeMessages
Displays triggered welcome messages
None
hideWelcomeMessages
Hide triggered welcome messages
None
openWelcomeMessage
Triggers a specific welcome message
messageId: string
openTool
Displays a specific tool in the panel
toolId: string

Type Definitions

type ToolEntry = {
/**
* Tool id
*
* @readonly
* @type {string}
*/
readonly id: string;
/**
* Tool type
*
* @readonly
* @type {ToolType}
*/
readonly type: ToolType;
/**
* Tool display name
*
* @readonly
* @type {string}
*/
readonly title: string;
/**
* Indicates if this is the only tool of this type that may exist
*
* @readonly
* @type {boolean}
*/
readonly isSingleton: boolean;
};
/**
* Types of engagement tools:
* - Live Chat ('tool-livechat')
* - Knowledge Library ('tool-knowledge-library')
* - Booking Calendar ('tool-booking-calendars')
* - Link Launcher ('tool-link-launcher')
* - Form/Survey ('tool-form-survey')
* - Webchat ('tool-webchat')
* - Reviews ('tool-reviews')
* - Extendly for HighLevel ('tool-support-chat')
* - TawkTo Livechat ('tool-tawkto')
* - Video Showcase ('tool-video-showcase')
* - Dedicated iFrame ('tool-dedicated-iframe')
* - Custom HTML ('tool-html')
* - Rich Content ('tool-rich-content')
*
* @export
* @typedef {ToolType}
*/
type ToolType =
| 'tool-livechat'
| 'tool-knowledge-library'
| 'tool-booking-calendars'
| 'tool-link-launcher'
| 'tool-form-survey'
| 'tool-webchat'
| 'tool-reviews'
| 'tool-support-chat'
| 'tool-tawkto'
| 'tool-video-showcase'
| 'tool-dedicated-iframe'
| 'tool-html'
| 'tool-rich-content';