Skip to main content

Integrate to Slack

You can integrate your application to Slack to receive and send messages in your Slack channels. After finishing this guide, you will have a Slack bot that will answer to messages with the responses generated by your application.

Prerequisites

  • A Slack account with a created workspace
  • Access to manage applications under your TaskingAI workspace

Step 1: Create a Slack App

First you need to create a Slack app that will be configured to be your bot. To create a Slack app, follow these steps:

  1. Visit your Slack App console at https://api.slack.com/apps.
  2. Click the Create New App button on the top right.

create slack app

  1. Select From scratch as creation method, then enter an App Name and select your target workspace.

create slack app from scratch

  1. After successfully creating the application, you will be redirected to the app's configuration page. In the basic information section, you can find the App ID and Signing Secret of your app. Keep these values safe as you will need them later.

slack app basic information

Step2: Add bot permissions

To allow your app to send and receive messages in your Slack workspace, you need to add the necessary permissions to your app. To add permissions, follow these steps:

  1. In the left sidebar, click the OAuth & Permissions tab.
  2. Scroll down to the Scopes section, and add the following bot token scopes:
    • app_mentions:read
    • chat:write
    • im:history
    • im:read
    • im:write
    • mpim:history
    • channels:history

slack add permissions

  1. Stay under the OAuth & Permissions tab, and click the Install to Workspace button under OAuth Tokens to install the app to your workspace.

slack install to workspace

  1. After installing the app to your workspace, you will be able to see an OAuth Access Token which starts with xoxb-. Keep this token safe as you will need it later.

slack bot token

Step 3: Configure the Slack Integration in TaskingAI

After the previous steps, you are ready to configure your Slack integration on TaskingAI platform.

  1. Log in to TaskingAI console, and navigate to the Applications tab under Workspace.
  2. Click on the application you want to integrate with Slack.
  3. On the tab selection bar on the top, click on the Channels tab.
  4. Select Slack and provide the necessary information, including Application ID, Signing Secret, and Bot User Auth Token you obtained from previous steps.
  5. Click Activate after filling in the information.

Slack Integration

note

On the top of the configuration, a Webhook Url is displayed. You will need this URL to register a webhook on Slack in the next step.

Step 4: Register webhook on Slack

To receive messages from Slack to your TaskingAI application, you need to register a webhook URL in your Slack app. To register a webhook, follow these steps:

  1. Go back to your application on Slack, and navigate to Event Subscription tab.
  2. Turn on the Enable Events toggle, and enter the URL of your TaskingAI application in the Request URL field. You can find the URL in the Slack integration configuration on TaskingAI Platform, as shown in the previous section.

Allow message tab

  1. expand the Subscribe to bot events section, and add the following bot events:
    • app_mention
    • message.im

Subscribe to bot events

  1. After adding the events, click the Save Changes button to save the webhook configuration.

Step 5: Allow direct messages to the bot (Optional)

By default, the bot will only respond to messages in accessible channels that mention the bot. If you want the bot to respond to direct messages, please visit App Home in your Slack app settings and scroll down to Show Tabs section, and enable the Allow users to send Slash commands and messages from the messages tab option.

Allow message tab

Step 6: Test the Integration

After completing the previous steps, you can test the integration by mentioning your Slack bot in a channel. The bot should respond with the generated response from your TaskingAI application.

Test integration

If you also allowed direct messages to the bot as described in Step 5, you can also send a direct message to the bot to receive a response.