Slack offers many IRC-like features, including persistent chat rooms (channels) organized by topic, private groups, and direct messaging. Content, including files, conversations, and people, is all searchable within Slack. Users can add emoji buttons to their messages, on which other users can then click to express their reactions to messages.

Slack's free plan allows only the 10,000 most recent messages to be viewed and searched.

Pre-Installation Requirements

Make sure that you have a Slack account and you are authorized in Slack API

How to create a bot in Slack

  1. Open the Slack API:

  1. Go to Your Apps and click Create an App:

  1. Choose a name for your app and select your workspace:

You will be redirected to your app page to the Basic Information page:

  1. Scroll down to the App Credentials section:

Bot Integration with Flow

  1. Open the drop-down menu in the top-left corner of the app and select the project to which you would like to connect Slack.

  1. Go to the Integrations section and click +:

  1. Select the Slack option:

  1. Before setting the URLs, save the "Slack Client ID", "Slack Client Secret", and "Slack Signing Secret" fields for the next configuration operations:

  1. Copy the "OAuth URL" , go to "OAuth & Permissions" and then click Add New Redirect URL:

  1. Click Save URLs:

  1. Scroll down to the Scopes section and set the list of scopes to the "Bot Token Scopes":
  • channels:history
  • chat:write
  • groups:history
  • im:history
  • im:read
  • incoming-webhook
  • users:read
  1. Scroll down and set the list of scopes to the "User Token Scopes":
  • im:read
  1. Go to the App Home and select the "Always Show My Bot as Online" options. (You can also change the display name of your bot.)

  1. Copy the "Events Request URL" and go to "Event Subscriptions", toggle the "Enable Events" checkbox and paste the URL:

  1. Scroll down to the Subscribe to bot events section and set the list of events:
  • message.channels
  • message.groups
  • message.im
  1. Scroll down to the Subscribe to events on behalf of users section and set the list of events:
  • im_created
  • And press "Save Changes"
  1. Go to "Incoming Webhooks" and toggle the "Activate Incoming Webhooks" checkbox:

  1. Go to "Interactivity & Shortcuts" and toggle "Interactivity" checkbox and set the "Actions Request URL":

  1. Go to Install App and click Install App and select a environment to post messages by bot:

Now you can see the bot is online:

  1. Go to OAuth & Permissions and copy "OAuth Access Token" and "Bot User OAuth Access Token" and provide it to flow.ai's slack integration

Now you can test your Slack bot.

Bot Testing

Create a flow:

Let's test it:

The bot behavior

The direct messages behavior

When you are reaching out the bot by sending direct messages to itself the bot will reply in a line to you.

But you can also start new conversation in thread.

The channel/group behaviour

After the bot was installed in the Slack workspace, you can use it everywhere.

To add a bot to a channel/group:

  1. Go to your bot, click on the "Info" icon, select more options, and select "Add this app to a channel..."

  1. Select a channel and press "Add"

  1. Go to the channel and you can see the message the bot was added

In the channels/groups bot will reply in thread on each message that the channel/group received, and you also can continue conversation on a thread or join another thread or send new message to create new conversation.

Broadcasting

Slack also supports broadcasting.

Check out this Audience and Rest API Broadcasting.