新しいドキュメントサイトへようこそ。これまで日本語で公開されていた記事は、本サイトでもご利用いただけます。サイトをご利用の際に、ブックマークを新しいURLに更新してください。日本語版がない記事は、英語版をご利用ください。日本語コンテンツは今後も引き続き更新していきます。

Work with In-App Hub API

Prev Next
This content is currently unavailable in Ja - 日本語. You are viewing the default (English) version.

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('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.

New API - open.png

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.

New API - hide.png

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.

New API - close.png

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