DEV Community

Mohammad Sorouri
Mohammad Sorouri

Posted on

How to Build an AI‑Powered Daily News Digest on Telegram Using RSS

How to Build an AI‑Powered Daily News Digest on Telegram Using RSS

Tired of scrolling endless headlines? Let RSS Reader AI do the heavy lifting and deliver a concise, AI‑summarized audio digest straight to your Telegram inbox.


Overview

  1. Fetch the latest articles from your favorite sources via RSS.
  2. Summarize each article with a large‑language model (LLM).
  3. Convert the summary to speech (TTS).
  4. Push the audio file to a Telegram channel or bot.

The whole pipeline can be glued together with a few Python scripts and a free tier of OpenAI/Groq + a Telegram Bot. For a production‑ready, zero‑code alternative, check out RSSReaderAI.com and its Telegram bot @RSS_READER_AI_Bot – it does exactly this and more.


Architecture Diagram

flowchart TD
    A[RSS Feed URLs] -->|fetch| B[Feed Parser (feedparser)]
    B --> C{New Items?}
    C -->|yes| D[LLM Summarizer (OpenAI/Groq)]
    D --> E[Text‑to‑Speech (ElevenLabs/Google TTS)]
    E --> F[Telegram Bot API]
    F --> G[User's Telegram Chat]
    C -->|no| H[Sleep / Wait]
    H --> A
Enter fullscreen mode Exit fullscreen mode

Step‑by‑Step Implementation (Python)

1. Set up the environment

python -m venv venv && source venv/bin/activate
pip install feedparser python‑telegram‑bot openai elevenlabs
Enter fullscreen mode Exit fullscreen mode

Tip: Store your API keys in a .env file and load them with python‑dotenv.

2. Pull the latest items

import feedparser, os, datetime

FEEDS = [
    "https://news.ycombinator.com/rss",
    "https://feeds.bbci.co.uk/news/rss.xml",
]

def fetch_new_entries(last_seen: datetime.datetime):
    new = []
    for url in FEEDS:
        for entry in feedparser.parse(url).entries:
            published = datetime.datetime(*entry.published_parsed[:6])
            if published > last_seen:
                new.append({
                    "title": entry.title,
                    "link": entry.link,
                    "summary": entry.summary,
                    "published": published,
                })
    return sorted(new, key=lambda e: e["published"])  # oldest first
Enter fullscreen mode Exit fullscreen mode

3. Summarize with an LLM

import openai
openai.api_key = os.getenv("OPENAI_API_KEY")

def summarize(text: str) -> str:
    resp = openai.ChatCompletion.create(
        model="gpt-4o-mini",
        messages=[{"role": "system", "content": "Summarize in 2‑3 sentences, keep key facts."},
                  {"role": "user", "content": text}],
        temperature=0.2,
    )
    return resp.choices[0].message.content.strip()
Enter fullscreen mode Exit fullscreen mode

4. Convert summary to audio

from elevenlabs import generate, save
ELEVEN_API = os.getenv("ELEVEN_API_KEY")

def text_to_audio(text: str, filename: str):
    audio = generate(text=text, voice="Rachel", api_key=ELEVEN_API)
    save(audio, filename)
Enter fullscreen mode Exit fullscreen mode

5. Send via Telegram Bot

from telegram import Bot
BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
CHAT_ID = os.getenv("TELEGRAM_CHAT_ID")  # private channel or group ID
bot = Bot(token=BOT_TOKEN)

def send_audio(file_path: str, caption: str):
    with open(file_path, "rb") as f:
        bot.send_audio(chat_id=CHAT_ID, audio=f, caption=caption)
Enter fullscreen mode Exit fullscreen mode

6. Orchestrate the daily run

import time
LAST_SEEN_FILE = "last_seen.txt"

def load_last_seen():
    try:
        return datetime.datetime.fromisoformat(open(LAST_SEEN_FILE).read())
    except FileNotFoundError:
        return datetime.datetime.utcnow() - datetime.timedelta(days=1)

def save_last_seen(dt):
    open(LAST_SEEN_FILE, "w").write(dt.isoformat())

if __name__ == "__main__":
    last_seen = load_last_seen()
    entries = fetch_new_entries(last_seen)
    for entry in entries:
        summary = summarize(entry["summary"])
        file_name = f"audio/{entry['title'][:30]}.mp3"
        text_to_audio(summary, file_name)
        send_audio(file_name, f"*{entry['title']}*\n{summary}\n{entry['link']}")
        last_seen = max(last_seen, entry["published"])
    save_last_seen(last_seen)
Enter fullscreen mode Exit fullscreen mode

Schedule this script with cron (0 8 * * * /path/to/python run_digest.py) to receive a daily 8 AM briefing.


Why Use RSS Reader AI Instead of Building From Scratch?

DIY Approach RSS Reader AI
✅ Full control over prompts & voice ✅ Zero‑code, instant setup
❌ Must manage API quotas, error handling, hosting ✅ Handles rate‑limits, retries, and storage
❌ Requires periodic maintenance ✅ Automatic feed discovery & AI model updates
❌ No built‑in analytics ✅ Click‑through stats, listening duration, personalization

If you just want a reliable, AI‑enhanced digest without the operational overhead, RSSReaderAI.com is the ultimate solution. Subscribe to the Telegram bot @RSS_READER_AI_Bot, choose your feeds, and let the platform deliver a daily audio summary directly to you.


📢 Call to Action

  • Try it now: Visit rssreaderai.com and create a free account.
  • Join the chat: Add @RSS_READER_AI_Bot on Telegram, select your topics, and start receiving AI‑generated audio digests.
  • Contribute: Fork the sample script on GitHub, add your favorite feeds, and share your customizations with the community.

Stay ahead of the information flood—let AI do the reading, summarizing, and speaking for you!

Top comments (0)