Skip to main content

Slack as an inbound channel

To start using Slack as an inbound channel:

  1. Create and configure an application.
  2. Create a channel.
  3. Connect a bot.
  4. Test the bot.

Step 1. Create and configure an application

Before creating a channel in JAICP, you should create a Slack application and specify scopes and parameters required for the bot to work. As a result, the application will gain access tokens necessary to work with the Slack API. You will need them when creating a channel.

Create an application

  1. Sign in to Slack and go to the Slack API website.
  2. Click Create New App → From scratch.
  3. Specify the application name.
  4. Specify the workspace you want to connect the bot to or create a new one. To create a workspace, click the Sign into a different workspace link and follow the steps required.
  5. Save the changes.

Configure an application

  1. Check that you use old design for application settings page. Otherwise, click Revert to the old design in the sidebar.

    Example of the Basic Information page in the old design.

    Old design

  2. On the Basic Information page of your application, expand the Add features and functionality setting group and select Bots.

  3. In the sidebar, select the OAuth & Permissions section and specify the following parameters in Scopes:

    • For Bot Token Scopes: chat:write, im:history, users.profile:read, files:read.
    • For User Token Scopes: im:history, im:read, im:write, users.profile:read.
  4. In the sidebar, select the App Home section.

  5. Click Edit in the Your App’s Presence in Slack setting group and specify:

    • Display Name (Bot Name).
    • Default username (it will be used when the bot is mentioned in messages).
  6. In the same setting group, enable the Always Show My Bot as Online option. Now, your bot will always be online.

  7. Go to the Show Tabs setting group and enable the Allow users to send Slash commands and messages from the messages tab option. This will allow users to send messages to the bot.

  8. Select the OAuth & Permissions section on the left pane and click Install to Workspace to publish the application.

  9. For the application, allow an access to a workspace.

  10. Copy the tokens: User OAuth Token and Bot User OAuth Token.

  11. In the sidebar, select the Basic Information section and copy the verification token in the App Credentials setting block.

Step 2. Create a channel

  1. In JAICP, open your bot project.

  2. In the dashboard, click Channels, then Connect channel in the Inbound section.

  3. In the Messengers and social networks section, select Slack.

  4. Specify the settings:

    • Name is the channel name.

    • Access token is the token copied from the Bot User OAuth Token field.

    • Verification token is the token copied from the Verification Token field on the Slack application page.

    • Application token is the token copied from the User OAuth Token field.

    • Branch is the project branch you want to deploy into the channel (master by default). You can also select a Git tag or enter a specific commit hash.

    • Agent is a customer engagement platform (if you want to enable your bot to transfer dialogs to an agent when necessary). It should be configured and connected to your project.

    • Deployment is one of the two deployment options:

      • Automatic: when you save the changes into the project.
      • Manual: with the Deploy button in the channel description.
      You have to deploy a script before starting the bot. At this stage, the system builds the bot, checks the script syntax, and performs tests.
  5. Click Create.

  6. Wait for the pop-up window with the result of the deployment.

Step 3. Connect a bot

  1. On the Channels page, click in the line with the Slack channel. Then, select Edit channel.
  2. Copy values from the Event request example and Interactive subscription request example fields.
  3. Go to your application page on the Slack API website.
  4. In the sidebar, select the Event Subscriptions section and turn on the Enable Events option.
  5. Paste the value copied from the Event request example field in Request URL.
  6. Expand the Subscribe to bot events setting group and add the event to be handled by the bot.
  7. Save the changes.
  8. In the sidebar, select the Interactivity & Shortcuts section and turn on the Interactivity option.
  9. Paste the value copied from the Interactive subscription request example field in Request URL and save the changes.

Step 4. Test the bot

Open Slack and go to the workspace you have connected the bot to. Select the bot in the Apps section and send a welcome/an activating phrase stated in your bot script. After that, your dialog with the bot starts.