Enabling Slack in a chatbot application
The following image describes the process of configuring Slack to work with your BMC Helix Virtual Agent application:
Task 1: To create an application in Slack and set the application scope
- Create a Slack workspace and an application in Slack.
(Optional) Invite new members to your workspace.
Create a Slack App to create an application in Slack, and complete the steps in the wizard.
Configure a bot user for your Slack application as specified in Creating a bot user.
Set the OAuth permissions.
- Navigate to the application that you created in Slack.
- Select OAuth & Permissions.
- Select Scopes > Bot Token Scopes and select the following OAuth scopes:
- channels:history
- chat:write
- files:read
- files:write
- users:read
- im:history
- The following image shows the Bot Token Scopes that you must select:
- On the OAuth & Permissions page, in the OAuth Tokens & Redirect URL section, click Install App to Workspace.
- Copy the Slack application credentials.
- On the OAuth OAuth & Permissions page, click Install Workspace to get the Access Token.
- In the Tokens for Your Workspace section, copy the Bot User OAuth Access Token.
- In the left pane, under the Settings menu , select Basic Information.
Copy the following credentials:
- App ID
- Verification token
The following image shows the Slack application credentials that you must copy:
Task 2: To configure a chatbot application to work with Slack
- Log in to BMC Helix Innovation Studio.
- On the Workspace tab, click the application in which you want to configure a chatbot to work with Slack.
- Click the Chatbots tab, and click the chatbot that you want to configure to work with Slack.
- Click the Channels tab and select New > Slack.
In the Slack Settings section, enter values for the following fields, and click Save.
Field
Description
Description
Enter the description that provides details about the setting.
Slack Application ID
Enter the App ID that you copied earlier.
Slack Bot User Auth Access Token
Enter the Bot User OAuth Access Token that you copied earlier.
Slack Verification Token
Enter the Verification Token that you copied earlier.
Webhook URL
(Information only) This field is populated automatically.
Webhook URL is the Request URL that you provide when you configure your Slack application.Copy the Webhook URL for future reference.
Task 3: Subscribe to Slack event and configure interactive components
You must subscribe to events in Slack to receive notifications for these events, such as when the end user posts a message. You also configure the interactive components in Slack such as buttons, menus, and date pickers.
Subscribe to Slack events.
- Navigate to the application that you created in Slack.
- In the left pane, under the Features menu, select Event Subscriptions.
- In the Enable Events section, select the Enable Events toggle button.
- In Request URL, enter the webhook URL that you copied earlier.
- Click Subscribe to bot events and add message.im.
- In Subscribe to events on behalf of users, ensure that you have not added any Workspace event.
The following image shows the bot event that you must subscribe:
- Configure the interactive components.
- Navigate to the application that you created in Slack.
- In the left pane, under the Features menu , select Interactivity & Shortcuts.
- In Interactivity, select the Interactivity toggle button.
- In Request URL, specify the webhook URL that you copied earlier, and save the changes.
- Reinstall the app.
- (If you are using Slack Enterprise Grid), under Features, select App Home.
- In the Show Tabs section, select Allow users to send Slash commands and messages from the messages tab.
The following image shows the Show Tabs section:
You have now configured Slack to work with BMC Helix Virtual Agent.
To migrate the classic Slack application
- Navigate to the application that you created in Slack.
- In the left pane, under the Tools menu, select Update to Granular Scopes.
- Set Bot Token Scopes.
- Delete all the existing Bot Token Scopes that you has set earlier.
- Select the following Bot Token Scopes:
- channels:history
- chat:write
- files:read
- im:history
- Delete all the User Token Scopes that you selected earlier.
- Select Yes, migrate my app, as shown in the following example:
Subscribe to bot events.
- In the left pane, under the Features menu, select Event Subscriptions.
- Delete all the Events that you subscribed to earlier.
- Click Subscribe to bot events and add the message.im event.
For more information about migrating the classic Slack application, see Migration guide for classic Slack apps