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 press "Create an App":
Choose name for your app and select your workspace:
After it you will be redirected to your app page to "Basic information" page:
Scroll down to "App Credentials" section:
Bot Integration with Flow
Select the project to which you would like to connect Slack using the top left drop-down menu.
Go to the “Integrations” section and press the “+” sign:
Choose “Slack” option inside the opened modal window:
Before to set the URLs you need to save the "Slack Client ID", "Slack Client Secret", "Slack Signing Secret" fields for next configuration operations:
Copy the "OAuth URL" and go to "OAuth & Permissions" and press "Add New Redirect URL":
After it press "Save URLs":
Scroll down to "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" and also you may 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 "Subscribe to bot events" section and set the list of events:
- message.channels
- message.groups
- message.im
Scroll down to "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 press "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
Once bot was installed to the slack workspace it can be used everywhere
Below will be instructions how to add 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 is also supporting broadcasting
Checkout this Audience and Rest API Broadcasting