Skip to content

πŸ“± Daily Slack Notification is an automated Slack bot that schedules and announces daily stand-up meetings, informing the team about who will be presenting. It uses GitHub Actions for automatic execution and cron scheduling.

License

Notifications You must be signed in to change notification settings

pripoliveira50/daily-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Daily Slack Notification – The Daily Assistant for Slack

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.


πŸ“Œ How to Create a Slack API for This Bot?

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.


πŸ“Œ Features

  • βœ… 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.

πŸ›  Technologies Used

This project was developed using:

  • Python 3.9
  • GitHub Actions (for execution automation)
  • Requests (for integration with the Slack API)

πŸ“‚ Project Structure

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

πŸ”„ Presenter Selection Logic

The daily presenter is selected sequentially, ensuring a fair rotation among members.

πŸ“Œ How Does It Work?

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.


πŸ”Ή Example:

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.


πŸš€ Setup and Usage

1️⃣ Prerequisites

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

2️⃣ How to Run the Project Locally?

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

πŸ“… Scheduling via GitHub Actions

GitHub Actions allows bots to be automatically and manually executed.

πŸ”Ή Automatic Execution

The bot can be scheduled to run at specific times using cron jobs in GitHub Actions.

Example configuration (.github/workflows/ci.yaml):

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.


βœ… Testing and Debugging

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.


🚨 Troubleshooting

  • 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).
  • The bot is not running automatically

    • Confirm that GitHub Actions is enabled in the repository.
    • Check the workflow history for possible errors.

🀝 How to Contribute

Please refer to our Contribution Guide to learn how to contribute to the project.


πŸ“„ License

This project is under the MIT License.

πŸ’‘ Developed to help agile teams keep their daily stand-ups organized! πŸš€

πŸš€ Made with ❀️ by Priscila Oliveira

About

πŸ“± Daily Slack Notification is an automated Slack bot that schedules and announces daily stand-up meetings, informing the team about who will be presenting. It uses GitHub Actions for automatic execution and cron scheduling.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages