A Telegram bot for managing and monitoring urlwatch jobs, including crontab integration, via chat commands.
- View, add, edit, and delete urlwatch jobs from Telegram
- Manage filters and properties for each job
- Secure access via allowed user IDs
- Crontab integration: view, add, edit, and delete scheduled urlwatch jobs from Telegram
- Detailed help and usage instructions via
/start
📁 CronWatchBot/
├── ⚙️ config/
│ ├── 🐍 config.py
│ ├── 📝 config.py.example
│ └── 🐍 logging.py
├── 📁 handlers/
│ ├── 🐍 basic.py
│ ├── 🐍 crontab_manage.py
│ └── 🐍 urlwatch_manage.py
├── 📁 helpers/
│ ├── 🐍 crotab_helpers.py
│ ├── 🐍 urlwatch_helpers.py
│ └── 🐍 utils.py
├── 🐍 main.py
├── 📜 LICENSE
├── 📄 requirements.txt
└── 📄 README.md
- urlwatch (installed and configured)
- crontab (cron service enabled)
- conda (recommended, for environment management,
miniforgeworks) - Telegram bot token and User ID (create bot and get token from @BotFather from Telegram and keep it secret)
-
Clone the repository:
git clone <repo-url> cd CronWatchBot
-
Create and activate a conda environment (recommended):
conda create -n cronwatchbot python=3.12 conda activate cronwatchbot
-
Install dependencies:
pip install -r requirements.txt
-
Configure your bot:
- Copy
config/config.py.exampletoconfig/config.py(or create manually). - Add your Telegram bot token and allowed user IDs:
TOKEN = "your-telegram-bot-token" ALLOWED_USER_IDS = [123456789, ...]
config/config.pyis excluded from git for security (see.gitignore).
- Copy
-
Ensure urlwatch is set up:
- The bot expects your urlwatch jobs file at
~/.config/urlwatch/urls.yamlby default.
- The bot expects your urlwatch jobs file at
- Activate your conda environment and run the bot:
conda activate cronwatchbot python main.py
- Interact with your bot on Telegram.
Start the bot and use /start to see available commands.
- Add a job to watch a website:
/add https://github.com/AnkS4/CronWatchBot CronWatchBot Repo
- Edit the job to get specific information from the website:
/editfilter 1 xpath://span[@id="repo-stars-counter-star"] html2text strip
- Add a job to run urlwatch job 1 every 30 minutes:
/crontab_add 1 30
/start— Show quick start message/help— Show detailed help message
/view— View all urlwatch jobs/add <url> [name]— Add a new job/edit <index> <url> [name]— Edit a job's URL and name/editfilter <index> [filters...]— Edit filters for a job/editprop <index> [props...]— Edit properties for a job/delete <index>— Delete a job
/crontab_view— View all urlwatch jobs in crontab/crontab_add <job_index> <minutes>— Add a scheduled job (runs the selected urlwatch job every N minutes)/crontab_edit <index> <minutes>— Edit a scheduled job/crontab_delete <index>— Delete a scheduled job
- Only user IDs listed in
ALLOWED_USER_IDScan use the bot. - Never commit your
config/config.pyto version control.