Command Component
This guide shows how to add the Scout Command module to your website.
Before implementing this code, you'll want to build an app in your Dashboard. You can grab the app's id
on its detail page. You will also need your org's public key, which you can find on the settings page.
Adding the widget to your website
To add the Command module to your own application, include the following in your <head>
tag:
<link rel="stylesheet" href="https://assets.scoutos.com/cmd/style.css" />
<script async src="https://assets.scoutos.com/cmd/iife.js"></script>
Then include this empty <div>
tag right before your closing </body>
tag. Set the data-app-id
value to the app id.
<div id="scout-cmd" data-app-id="your-app-id" data-public-key="org-public-key"></div>
Binding the cmd widget open function to a DOM element
If you want to trigger the cmd module to open when a DOM element is clicked, you can add the id scout-cmd-trigger
to the element. If you would like to use the styling to put a button on the bottom right of the screen, you can use class cmd_main-container-button
, but you can use any element/styling you want.
<button
class="cmd_main-container-button"
id="scout-cmd-trigger"
>
Ask AI
</button>
Setting custom hotkey
By default, the widget will show when a user clicks cmd + k. If you would like it to trigger on another key besides k, you can set it on the data-cmd-hotkey
attribute. In the example below, the cmd will launch when the user keys in cmd + i
.
<div id="scout-cmd" data-app-id="your-app-id" data-cmd-hotkey="i" data-public-key="org-public-key"></div>
Disable hotkey
By default, the widget will show when a user clicks cmd + k. If you would like to disable that, you can set the data-hotkey-disable
attribute to 'true'
.
<div id="scout-cmd" data-app-id="your-app-id" data-hotkey-disable="true" data-public-key="org-public-key"></div>
Adding Custom Colors to the Command Component
To customize the colors of the command component, go to the app page and open the side menu by clicking the "i" icon on the top right. You should see a section called "Command Component Settings". You can change the colors there.
Suggested Questions
The suggested questions are the questions that are shown to the user when they click on the command component. You can change the suggested questions in the app settings menu, under the "Command Component Settings" section.
Set Display Name
The display name used for the bot in the command component is the name of the app. You can change the name of the app in the app page.
Set Avatar
The avatar used for the bot in the command component is the avatar of the app. You can change the avatar of the app in the app page.