In order to use Digital Assistant as a chatbot inside Slack, please follow the instructions set out in this article.
If you're running Digital Assistant in a local environment, you need to first make your web server publicly accessible.
Using your existing Slack account, navigate to https://api.slack.com/apps and click on Create an App
On the following screen give your app a name, and select the relevant workspace you want to add the app to (provided you are part of multiple workspaces).
Click on Create to reach the settings page for your new app. In the next few steps we will need the three menus highlighted in the red box:
The Bot User will be the identity the users will be interacting with through chat. Click on Bot Users on the left. On the next screen you can Add a Bot User
Now enter a username and Display name for your bot user. Ideally, you'll want something that reflects the name of your Digital Assistant frontend, i.e. if you have branded Digital Assistant with a unique name then you should re-use this name here.
Event and Scopes is used to configure how to react to user inputs, i.e. forward text messages to Digital Assistant and reply back with the search result.
First, click on Event Subscriptions on the left. On the next screen toggle 'Enable Events' to on.
To configure these, we need to enter the Request URL where Digital Assistant accepts HTTP requests send by Slack.
Type in the public URL of your server, and follow it with '/botslack', i.e.
https://<your-server-name>/botslack. Once you entered the URL, a challenge is sent that Digital Assistant will respond to. This will give us the 'Verified' message from Slack.
If you don't receive a 'Verified' message, contact your server administrator to provide you with the correct URL.
Next we need to enter information under Subscribe to Bot Events. Please follow the next steps:
We don't recommend to add multiple events, but depending on your needs you may want a different event of the 'message' category of events.
Finally let's set the permissions which are called "Scopes". Click on OAuth & Permissions.
In the input under Select Permission Scopes start typing in
message and add all the following scopes one by one:
users:read is used to read a user's email address from Slack to match it with a user in Digital Assistant.
Click Save Changes at the bottom to confirm your selection. The finished result should look like this:
Let's bring this app into your Workspace, by clicking on OAuth & Permissions and then Install App to Workspace.
On the next screen you need to confirm the security message by Slack by clicking Authorize.
Now back on the OAuth & Permissions screen take a note of your Bot User OAuth Access Token for the next step.
You can give the user the option to select the same buttons in the Slack UI as you offer them on the original Assistant Card. To enable this feature click on Interactive Components on the left.
Under Request URL enter
Should the Assistant Card have buttons configured they will now automatically show as interactive buttons in the Slack UI, too.
The botslack endpoint is protected from unauthorized usage, so we will have to configure the settings for it to allow our Slack bot requests provided the correct token is present.
Open your Digital Assistant in the browser and go to the following address:
On the Slack Bot Settings screen paste your Bot User OAuth Access Token from Step 5. Save the setting by clicking the checkmark button.
Your bot should be good to go now. Open your Slack client and add your new app. Now send your bot user a "test" message:
We'd expect the bot to reply with "I'm sorry, I don't understand: test".
Now try a phrase that you know finds a Card in the search results in Digital Assistant, for example "Show me my PTO".
The bot will then either respond that it found a Card or shows the answer directly if the Card is configured to be "Adaptive" in the Card Designer.
If the bot replies with "Please login once to your Digital Assistant before using the bot." then the current Slack user either wasn't matched with a user in Digital Assistant, or hasn't logged in.