The Daily Slack Notification is an automated bot for Slack that schedules and announces the daily stand-up meeting, highlighting who will be responsible for the day's presentation. π
This bot creates an API in Slack using a Slack App with the necessary permissions to send messages to a specific channel.
To use this bot, you will need to create a Slack App and get the required tokens. Follow the official Slack documentation: π Create a Slack App
The process is fully automated via GitHub Actions, allowing scheduled daily execution via cron jobs or manual execution whenever needed.
- β Automatic daily announcement in Slack.
- β Sequential selection of the presenter from the configured members.
- β Correct mention of the presenter in Slack (using user IDs).
- β Automated execution via GitHub Actions with scheduling (cron) support.
- β
Manual execution via GitHub Actions
workflow_dispatch
.
This project was developed using:
- Python 3.9
- GitHub Actions (for execution automation)
- Requests (for integration with the Slack API)
The project follows the structure below:
.
βββ .github/workflows/ # GitHub Actions configuration
β βββ ci.yaml # Workflow for automated execution
βββ scripts/ # Directory for Python scripts
β βββ daily_slack.py # Script responsible for sending messages to Slack
βββ .gitignore # File to ignore unnecessary files in the repository
βββ LICENSE # Project license
βββ README.md # Project documentation
The daily presenter is selected sequentially, ensuring a fair rotation among members.
The script maintains a pre-configured list of team members (via SLACK_MEMBERS
) and selects the next in line each day. When all members have presented, the order resets to the beginning.
If SLACK_MEMBERS="U123456,U654321,U987654"
, the presentation order will be:
1οΈβ£ Day 1: U123456
2οΈβ£ Day 2: U654321
3οΈβ£ Day 3: U987654
4οΈβ£ Day 4: U123456 (restarts)
This logic ensures a fair rotation and prevents random selection.
Before running the script, ensure you have:
- Python 3.9+ installed.
- A Slack bot configured with permissions to send messages.
- The following environment variables are configured in GitHub Actions:
Variable | Description |
---|---|
SLACK_TOKEN |
Slack authentication token |
CHANNEL_ID |
ID of the channel where the message will be sent |
SLACK_MEMBERS |
List of member IDs for presentation, separated by commas |
π‘ How to get Slack user IDs?
If you need user IDs, use the Slack API:
π Get Slack User List
1οΈβ£ Clone the repository:
git clone https://github.com/your-username/daily-slack-notification.git
cd daily-slack-notification
2οΈβ£ Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windows
3οΈβ£ Install dependencies:
pip install -r requirements.txt
4οΈβ£ Set environment variables:
export SLACK_TOKEN="your_token_here"
export CHANNEL_ID="your_channel_id_here"
export SLACK_MEMBERS="U12345,U67890,U54321"
π‘ On Windows, use:
set SLACK_TOKEN="your_token_here"
5οΈβ£ Run the script:
python scripts/daily_slack.py
GitHub Actions allows bots to be automatically and manually executed.
The bot can be scheduled to run at specific times using cron jobs in GitHub Actions.
name: Daily Slack Notification
on:
schedule:
- cron: "30 12 * * 1-5" # Runs at 12:30 PM (UTC) Monday to Friday
workflow_dispatch: # Allows manual execution via GitHub Actions
jobs:
daily-slack-notification:
name: Send Slack Notification
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run Python script
run: python scripts/daily_slack.py
πΉ Note: The cron job can be adjusted to run at different times and days as needed.
If you need to test or debug the code:
1οΈβ£ Verify that environment variables are set correctly.
2οΈβ£ Test the Slack API manually using requests.post
.
3οΈβ£ Use print()
statements in the code to check variable values before sending the message.
-
The bot is not sending messages to Slack
- Check if the
SLACK_TOKEN
is correct and active. - Ensure the bot is present in the correct channel (
#your-channel
).
- Check if the
-
The bot is not running automatically
- Confirm that GitHub Actions is enabled in the repository.
- Check the workflow history for possible errors.
Please refer to our Contribution Guide to learn how to contribute to the project.
This project is under the MIT License.
π Made with β€οΈ by Priscila Oliveira