This project is a Slack bot that sends reminder messages to a specified Slack channel. The bot reads messages from a JSON file, selects a random message, and posts it to the channel at a specified time.
- Reads messages from a JSON file
- Selects a random message to send
- Posts messages to a specified Slack channel
- Configurable via environment variables
- Go 1.18 or later
- A Slack workspace and a bot token
- A JSON file containing the messages
-
Clone the repository:
git clone https://github.com/yourusername/slack-reminder-bot.git cd slack-reminder-bot
-
Install dependencies:
go mod tidy
Set the following environment variables:
SLACK_TOKEN
: Your Slack bot tokenSLACK_CHANNEL_ID
: The ID of the Slack channel where the bot will post messagesAFAS_URL
: The URL to be included in the reminder message
-
Create a JSON file named
messages.json
in theinput
directory with the following structure:{ "messages": [ "Message 1", "Message 2", "Message 3" ] }
-
Run the bot:
go run main.go
To run the unit tests, use the following command:
go test ./...
main.go
: The main entry point of the applicationblocks.go
: Contains the function to create Slack message blocksblocks_test.go
: Unit tests forblocks.go
day-utils_test.go
: Additional utility testsinput/messages.json
: JSON file containing the messages
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE
file for details.