Slack
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
- Open the Slack API:
- Go to Your Apps and click Create an App:
- Choose a name for your app and select your workspace:
You will be redirected to your app page to the Basic Information page:
- Scroll down to the App Credentials section:
Bot Integration with Flow
- 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.
- Go to the Integrations section and click +:
- Select the Slack option:
- Before setting the URLs, save the "Slack Client ID", "Slack Client Secret", and "Slack Signing Secret" fields for the next configuration operations:
- Copy the "OAuth URL" , go to "OAuth & Permissions" and then click Add New Redirect URL:
- Click Save URLs:
- 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
- Scroll down and set the list of scopes to the "User Token Scopes":
- im:read
- 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.)
- Copy the "Events Request URL" and go to "Event Subscriptions", toggle the "Enable Events" checkbox and paste the URL:
- Scroll down to the Subscribe to bot events section and set the list of events:
- message.channels
- message.groups
- message.im
- Scroll down to the Subscribe to events on behalf of users section and set the list of events:
- im_created
- And press "Save Changes"
- Go to "Incoming Webhooks" and toggle the "Activate Incoming Webhooks" checkbox:
- Go to "Interactivity & Shortcuts" and toggle "Interactivity" checkbox and set the "Actions Request URL":
- 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:
- 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:
- Go to your bot, click on the "Info" icon, select more options, and select "Add this app to a channel..."
- Select a channel and press "Add"
- 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.
Updated about 1 year ago