Work with Knowledge Center Bot API
This article explains the API calls that you can use to control the Knowledge Center Bot.
Overview
The embedded Knowledge Center (KC) Bot API allows you to access and control the KC Bot programmatically. You can control the KC Bot widget and window using the following API calls:
- Show: Shows the Bot widget.
- Open: Opens the Bot window.
- Hide: Hides the Bot widget.
- Close: Closes the Bot window
For more information on how to configure and create the embedded Knowledge Centre Bot, refer to the Embedded Knowledge Center Bot article from the Additional Resources section.
Knowledge Center Bot API Calls
This section explains the API calls for the KC Bot.
Show
The Show function shows only the widget. If the widget is not shown, the onError event is called. When the user clicks on the widget, the bot window opens.
Syntax
aptrinsic('kcb', 'show', { onDone: Function, // optional onError: Function // optional });
Following is an example call:
aptrinsic('kcb', 'show'); aptrinsic('kcb', 'show', { onDone: console.log }); aptrinsic('kcb', 'show', { onError: console.error }); aptrinsic('kcb', 'show', { onDone: console.log, onError: console.error });
Open
The Open function shows the open Bot window. If the Bot window does not open, the onError event is called.
Note:
Ensure to enable the KCB is Controlled Using API Commands And To Qualified Users option in Administration > SDK Settings.
Syntax
aptrinsic('kcb', 'open', { onDone: Function, // optional onError: Function // optional });
Following is an example call:
aptrinsic('kcb', 'open'); aptrinsic('kcb', 'open', { onDone: console.log }); aptrinsic('kcb', 'open', { onError: console.error }); aptrinsic('kcb', 'open', { onDone: console.log, onError: console.error });
Hide
The Hide function closes the Bot window that is active and hides the widget. If the Bot widget is not hidden, the onError event is called.
Syntax
aptrinsic('kcb', 'hide', { onDone: console.log, onError: console.error });
Following is an example call:
aptrinsic('kcb', 'hide'); aptrinsic('kcb', 'hide', { onDone: console.log }); aptrinsic('kcb', 'hide', { onError: console.error }); aptrinsic('kcb', 'hide', { onDone: console.log, onError: console.error });
Close
The Close Bot function closes the Bot window. If the Bot window does not close, the onError event is called.
Syntax
aptrinsic('kcb', 'close', { onDone: Function, // optional onError: Function // optional });
Following is an example call:
aptrinsic('kcb', 'close'); aptrinsic('kcb', 'close', { onDone: console.log }); aptrinsic('kcb', 'close', { onError: console.error }); aptrinsic('kcb', 'close', { onDone: console.log, onError: console.error });
Additional Resources
Embedded Knowledge Center Bot |