Building a Bot App for Slack

This article provides step-by-step instructions on how to build a Slack App with bot functions. The algorithm described here applies for:

1. Access Slack API Page

  1. Go to https://api.slack.com/apps?new_classic_app=1
  2. Specify the App Name
  3. Select your team for "Development Slack Workspace"
  4. [Create App]

2. Configure Interactive Components

If you are creating a bot app not using the MI Slackbot, skip this step and proceed to Add a Bot User.

Access Features > Interactivity & Shortcuts

  1. Switch the Interactivity toggle to "On"
  2. When the Interactivity option is activated, the Request URL field will be displayed
    1. Enter Request URL (<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)
  3. [Save Changes]

3. Add a Bot User

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

Access Features > App Home

  1. Click [Add Legacy Bot User]
  2. Enter Display Name (Bot Name) and Default username
  3. [Add]

4. 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.

Access Features > OAuth & Permissions

  1. [Add an OAuth Scope]
  2. 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. Direct messaging and mentioning the Slack App (bot)
    6. View some URLs in messages (links:read)
    7. Add link previews to messages (links:write)
    8. Upload and modify files as user (files:write:user):
      • Is needed by MI Application to send images to Slack directly
    9. Access information about user’s private channels (groups:read)

Navigate to the top of OAuth & Permissions page to proceed with connecting the app to your workspace.

5. Install App to Workspace

  1. [Install to Workspace]
  2. [Allow]
  3. Once the app is installed to your workspace, User OAuth Token and Bot OAuth Token are displayed at the top of the page