Creating a Slack bot to automate reminders involves building a bot that can integrate with Slack’s API, respond to commands, and send scheduled messages. Below is a concise implementation guide using Python, Flask, and Slack Bolt SDK.
Prerequisites
-
Python 3.8+
-
Slack workspace
-
Slack App created from https://api.slack.com/apps
-
Install dependencies:
Step 1: Create a Slack App
-
Go to https://api.slack.com/apps and create a new app.
-
Enable Socket Mode and Bot Token.
-
Under “OAuth & Permissions”, add:
-
chat:write -
commands -
reminders:write
-
-
Install the app to your workspace and save the Bot Token and App Token.
Step 2: Basic Bot Structure
Step 3: Configure the /remindme Slash Command
In the Slack App settings:
-
Navigate to Slash Commands.
-
Add
/remindmewith the request URL:https://yourdomain.com/slack/events(use ngrok or public URL during testing). -
Set the usage hint like:
Take a break in 10
Notes
-
Use
ngrokfor local testing:ngrok http 3000 -
You can enhance the bot to support recurring reminders, message editing, or use natural language parsing with
dateparser.
This script sets up a simple Slack bot that accepts reminder commands and sends automated messages after the specified delay.