Show HN: I built a tool to automate Slack status with rules and schedules

1 month ago 4

Lightweight Python service to automatically update Slack status based on a schedule and configurable rules.

This project lets you define status messages, emojis, and schedule rules so a small scheduler updates your Slack presence automatically. It supports both a local Python setup and a Docker-based deployment.

Demo

render1757708936291

  • Scheduled status updates using a configurable scheduler
  • Day-of-week scheduling - Different statuses for weekdays, weekends, or specific days
  • Time range constraints - Statuses that only apply during certain hours
  • Read configuration from config.yml (example provided)
  • Slack integration using a token-based API client
  • Dockerfile and docker-compose.yml for containerized deployment
  • Small, easy-to-read codebase (single module + package)

Prerequisites

  • Python 3.10+ (recommended)
  • pip for installing dependencies
  • A Slack user token with users.profile:write scope

Install dependencies

python -m venv .venv source .venv/bin/activate pip install -r requirements.txt

Create configuration

  1. Copy the example config:
cp config.example.yml config.yml
  1. Edit config.yml and set your Slack token and schedules. At minimum set slack.token and one schedules entry.

Run locally

# run the small app which starts the scheduler python slack_status.py

The service will read config.yml from the repository root by default.

Open config.example.yml (renamed to config.yml) to see available settings.

Simple time-based status updates with day constraints:

slack_token: "your-slack-token-here" intervals: - time: "07:30" days: "weekdays" presence: "auto" status_text: "Working" status_emoji: ":white_check_mark:" - time: "12:00" days: "weekdays" presence: "away" status_text: "Out for the day" status_emoji: ":x:"

Schedule statuses for specific days or time ranges:

slack_token: "your-slack-token-here" intervals: # Weekday working hours - time: "09:00" days: "weekdays" presence: "auto" status_text: "Working" status_emoji: ":computer:" # Weekend status - time: "09:00" days: "weekends" presence: "away" status_text: "Out of Office" status_emoji: ":palm_tree:" # Specific days - time: "18:00" days: ["monday", "wednesday", "friday"] presence: "away" status_text: "Gym time" status_emoji: ":muscle:" # Time range constraints (only active during specific hours) - time: "10:00" days: ["friday"] time_range: start: "10:00" end: "16:00" presence: "auto" status_text: "Friday focus time" status_emoji: ":dart:"

Each interval supports the following fields:

  • time (required): Time in HH:MM format when the status should be set
  • days (required): Day constraints - can be:
    • "weekdays" - Monday through Friday
    • "weekends" - Saturday and Sunday
    • ["monday", "tuesday", ...] - Specific days of the week
  • time_range (optional): Time range when the status is active
    • start: Start time in HH:MM format
    • end: End time in HH:MM format
  • presence: Slack presence ("auto" or "away")
  • status_text: Custom status message
  • status_emoji: Status emoji (e.g., :computer:)

Note: Time ranges can cross midnight (e.g., start: "22:00", end: "06:00").

Security note: Do not commit real tokens into git. Prefer environment variables or secrets.

Build and run with Docker Compose

docker compose build docker compose up -d

Environment variables

Set the token via environment variables or a mounted config.yml. Example docker-compose.yml in this repo demonstrates usage.

  • Logs: If running with Docker Compose, use docker compose logs -f.
  • Token errors: ensure the token has users.profile:write scope.
  • Config load errors: ensure yml indentation is correct and required fields exist.

👤 Filippo Finke

Read Entire Article