Skip to main content
Gainsight Inc.

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.

New API - show.png

Syntax

aptrinsic('bot', 'show', {
  onDone: Function, // optional
  onError: Function // optional
});

Following is an example call:

aptrinsic('bot', 'show');
aptrinsic('bot', 'show', {
  onDone: console.log
});
aptrinsic('bot', 'show', {
  onError: console.error
});
aptrinsic('bot', '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.

New API - open.png

Syntax

aptrinsic('bot', 'open', {
  onDone: Function, // optional
  onError: Function // optional
});

Following is an example call:

aptrinsic('bot', 'open');
aptrinsic('bot', 'open', {
  onDone: console.log
});
aptrinsic('bot', 'open', {
  onError: console.error
});
aptrinsic('bot', '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.

New API - hide.png

Syntax

aptrinsic('bot', 'hide', {
  onDone: console.log,
  onError: console.error
});

 Following is an example call:

aptrinsic('bot', 'hide');
aptrinsic('bot', 'hide', {
  onDone: console.log
});
aptrinsic('bot', 'hide', {
  onError: console.error
});
aptrinsic('bot', '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.

New API - close.png

Syntax

aptrinsic('bot', 'close', {
  onDone: Function, // optional
  onError: Function // optional
});

Following is an example call:

aptrinsic('bot', 'close');
aptrinsic('bot', 'close', {
  onDone: console.log
});
aptrinsic('bot', 'close', {
  onError: console.error
});
aptrinsic('bot', 'close', {
  onDone: console.log,
  onError: console.error
});

Additional Resources

Embedded Knowledge Center Bot
  • Was this article helpful?