This project periodically checks the official ASKİ outage page and posts updates to a Telegram forum (Topics) supergroup.
It sends a message only when something changes (new/updated outage entry) and posts into the correct district topic. If the topic does not exist yet, the bot creates it automatically.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCreate a .env file in the project root (see .env_example) and fill in: TELEGRAM_BOT_TOKEN TELEGRAM_CHAT_ID (your forum supergroup id, e.g. -100...) Load it into your shell:
source .envUseful for debugging group/topic updates:
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates"Run as a daemon (poll every 10 seconds):
python3 water_watch.py --daemon --interval-sec 10 --state-dir state --topics-file topics.jsonstate/ stores per-district “already sent” outage ids to avoid duplicate notifications. topics.json stores the mapping: DISTRICT -> message_thread_id (topic id). Your Telegram group must be a Topics-enabled (forum) supergroup, and the bot should be an admin.
To run the bot as a background process, you can use screen.:
screen -S water_watch
source .env
./.venv/bin/python3 water_watch.py --daemon --interval-sec 10 --state-dir state --topics-file topics.json
# To detach from screen session: Ctrl+A D
# To reattach: screen -r water_watch