Building a bot app for Slack

This article provides step-by-step instructions on how to build a Slack App with bot functions. This App must next be connected to the main MI application to be able to access content in Metric Insights and process queries submitted by your Slack users.

PREREQUISITES:

1. Access Slack API page

  1. Go to https://api.slack.com/apps
  2. Click [Start Building]

2. Create an App for your workspace

  1. Specify the App Name
  2. Select your team for "Development Slack Workspace"
  3. Click [Create App]

3. Configure Interactive components

  1. From the Slack App configuration page Settings > Basic Information, go to Features > Interactive Components
  2. Switch the Interactivity toggle to "On"
  3. When the Interactivity option is activated, the Request URL field will be displayed
    1. Enter Request URL (your_slackbot_server/slack/message_actions)
    2. The /slack/message_actions part of the URL must be exactly as specified
    3. Request URL is where the Slack server sends requests when Users interact with Slack app components (by clicking on buttons, invoking commands)
  4. Save to proceed

4. Add a Bot User

In order to use your Slack App as a bot, first you have to create a Bot User for it.

  1. Select Bot Users
  2. Click [Add a Bot User]
  3. Display name and Default Username will be added automatically (based on the App name you specified earlier)
  4. Switch the toggle to Always Show My Bot as Online
  5. Add Bot User and Save Changes

5. Install App to Workspace

To add an App to your Slack Workspace:

  1. Go to OAuth & Permissions
  2. Click [Install App to Workspace]
  3. Authorize

6. Grant permissions

A Slack App's capabilities and permissions are governed by named scopes.

For the Slack App to be able to handle User requests, add permissions from the Conversations group.

  1. Access OAuth & Permissions
  2. Select Permission Scopes
  3. From the dropdown, add the following Permissions:
    1. Access user's public channels (channels:history)
    2. Access information about user’s public channels (channels:read)
    3. Modify your public channels (channels:write)
    4. Send messages as ProdBot (chat:write:bot)
    5. Access information about user’s private channels (groups:read)
    6. Post to specific channels in Slack (incoming-webhook)
    7. Upload and modify files as user (files:write:user):
      • is needed by MI Application to send images to Slack directly
    8. View some URLs in messages (links:read)
    9. Add link previews to messages (links:write)
  4. Save Changes

7. Authorize Permissions

To make the changes effective, you need to authorize permissions.

After "Conversation permissions" have been granted,  Slack will prompt you to Select the Channel and Authorize permissions.

0 Comments

Add your comment

E-Mail me when someone replies to this comment