A Python bot that monitors RSS feeds and sends notifications to a Telegram chat when new content is published. The bot checks feeds at regular intervals, keeps track of which items have already been sent, and groups notifications by feed source for better readability.
- 📊 Monitors multiple RSS feeds from a simple text configuration file
- 📱 Sends notifications directly to a Telegram chat or channel
- 🔄 Configurable check interval
- 📦 Maintains history of sent items to avoid duplicates
- 📝 Groups notifications by feed source
- 🐳 Easy deployment with Docker
The bot:
- Reads RSS feed URLs from a configuration file
- Periodically checks each feed for new content
- Compares entries against a history of previously sent items
- Groups new content by feed source
- Sends formatted notifications to Telegram
- Updates the history file with newly sent items
- Python 3.8+ (for local installation)
- Docker (for Docker installation)
- A Telegram bot token (get one from @BotFather)
- Your Telegram chat ID (you can use @userinfobot)
-
Clone this repository:
git clone https://github.com/daquino94/rss-telegram.git cd rss-telegram
-
Install required dependencies:
pip install feedparser python-telegram-bot==20.7 requests
-
Create a data directory and feeds file:
mkdir -p data echo "# Add your RSS feeds below, one per line" > data/feeds.txt
-
Add your RSS feed URLs to
data/feeds.txt
:https://example.com/feed.xml https://anotherblog.com/rss
-
Run the bot:
TELEGRAM_BOT_TOKEN="your_bot_token" TELEGRAM_CHAT_ID="your_chat_id" python rss_telegram.py
-
Clone this repository:
git clone https://github.com/daquino94/rss-telegram.git cd rss-telegram
-
Create a data directory and feeds file:
mkdir -p data echo "# Add your RSS feeds below, one per line" > data/feeds.txt
-
Add your RSS feed URLs to
data/feeds.txt
. -
Run the Docker container:
docker build -t rss-telegram . docker run -d \ --name rss-telegram \ -e TELEGRAM_BOT_TOKEN="your_bot_token" \ -e TELEGRAM_CHAT_ID="your_chat_id" \ -e INCLUDE_DESCRIPTION="true" \ -e DISABLE_NOTIFICATION="false" \ -e CHECK_INTERVAL=3600 \ -v $(pwd)/data:/app/data \ rss-telegram
-
Create a directory for your data and configuration:
mkdir -p rss-telegram/data cd rss-telegram echo "# Add your RSS feeds below, one per line" > data/feeds.txt
-
Add your RSS feed URLs to
data/feeds.txt
. -
edit a docker-compose.yml with your bot token and your chat id or channel name (with @channelName)
-
Update the environment variables in docker-compose.yml with your Telegram bot token and chat ID.
-
Run the container:
docker-compose up -d
Or manually:
docker run -d \ --name rss-telegram \ -e TELEGRAM_BOT_TOKEN="your_bot_token" \ -e TELEGRAM_CHAT_ID="your_chat_id" \ -e INCLUDE_DESCRIPTION="true" \ -e DISABLE_NOTIFICATION="false" \ -e CHECK_INTERVAL=3600 \ -v $(pwd)/data:/app/data \ asterix94/rss-telegram:latest
The bot can be configured using environment variables:
Environment Variable | Description | Default |
---|---|---|
TELEGRAM_BOT_TOKEN |
Your Telegram bot token | Required |
TELEGRAM_CHAT_ID |
Your Telegram chat or channel ID | Required |
DISABLE_NOTIFICATION |
Disable telegram notification | false |
INCLUDE_DESCRIPTION |
Include description in the message | false |
CHECK_INTERVAL |
Time in seconds between feed checks | 3600 (1 hour) |
FEEDS_FILE |
Path to the file containing RSS feed URLs | /app/data/feeds.txt |
The bot stores two important files in the /app/data
directory:
feeds.txt
: List of RSS feed URLs to monitorsent_items.json
: History of already sent items (to avoid duplicates)
When using Docker, make sure to mount this directory as a volume to ensure data persistence between container restarts.
When running with Docker, logs are stored using the json-file driver with rotation (max 3 files of 10MB each). You can view logs with:
docker logs rss-telegram
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.