An automated system that generates and distributes daily AI news digests using Anthropic's Claude API.
- Multi-Provider LLM Support: Choose between Claude (Anthropic) or DeepSeek for news generation
- Real-Time News Fetching: Fetches actual news from RSS feeds for accurate, up-to-date content
- AI-Powered News Generation: Uses Claude Sonnet 4.5 or DeepSeek to generate comprehensive AI news digests
- Web Search Integration: Optional DuckDuckGo web search for additional news sources
- Beautiful Email Formatting: Automatically converts AI content to stunning HTML emails - no markdown, just clean professional design
- Customizable Prompts: 9 pre-built templates (comprehensive, research, business, technical, etc.) or create your own
- Multilingual Support: Generate news in 13+ languages including English, Chinese, Spanish, French, Japanese, and more
- Chinese News Sources: Built-in support for Chinese AI news sources (36Kr, JiQiZhiXin, etc.)
- Multiple Notification Channels: Supports email (via Resend.com) and webhook notifications
- Flexible Configuration: Easy-to-customize topics and notification settings via YAML config
- Automated Scheduling: GitHub Actions workflow for daily automated execution
- Robust Error Handling: Comprehensive logging and retry logic
- Email Client Compatible: Works perfectly in Gmail, Outlook, Apple Mail, and mobile email apps
- Modern Email Delivery: Uses Resend.com for reliable, developer-friendly email delivery
Choose your deployment method:
| Method | Configuration | When to Use |
|---|---|---|
| Local Development | .env file |
Testing locally on your computer |
| GitHub Actions | Repository Secrets | Automated daily runs (recommended) |
💡 Tip: Start with local development to test, then deploy to GitHub Actions for automation.
git clone <your-repo-url>
cd ai-news-botpip install -r requirements.txtFor local development, copy the example file and fill in your credentials:
cp .env.example .envEdit .env with your actual values:
# LLM Provider Configuration
LLM_PROVIDER=claude # Options: 'claude' or 'deepseek'
# API Keys (provide the one you're using)
ANTHROPIC_API_KEY=your_api_key_here # For Claude
DEEPSEEK_API_KEY=your_deepseek_api_key # For DeepSeek
# Optional: Email Configuration with Resend.com
RESEND_API_KEY=re_your_api_key_here
EMAIL_FROM=your_email@yourdomain.com
EMAIL_TO=recipient@example.com
# Optional: Webhook Configuration
WEBHOOK_URL=https://your-webhook-url.com/endpoint
# Notification Methods (comma-separated)
NOTIFICATION_METHODS=email,webhook
# Language Settings (optional, defaults to 'en')
AI_RESPONSE_LANGUAGE=zh
# Web Search (optional, defaults to false)
ENABLE_WEB_SEARCH=falseNote: The
.envfile is only for local development. For GitHub Actions automation, you'll configure these as GitHub Secrets (see GitHub Actions Setup below).
The bot uses an optimized, concise prompt (15 lines vs 50+ in typical systems) that generates high-quality news digests.
Default Prompt (in config.yaml):
Summarize 10 recent AI news items (5 international + 5 domestic) covering: {topics}
Format:
International News:
1. [Headline]
[2-3 sentence summary]
Source: [Name]
Domestic News:
1. [Headline]
...
Rules: Recent news, no markdown, clear languageWhy it's concise:
- ✅ Faster processing
- ✅ Lower cost
- ✅ Easier to maintain
- ✅ No redundancy
Multi-Language Support:
Prompts are in English (best for Claude), but output can be in 13+ languages:
# In .env file
AI_RESPONSE_LANGUAGE=zh # Chinese output
AI_RESPONSE_LANGUAGE=es # Spanish output
AI_RESPONSE_LANGUAGE=ja # Japanese output
# Supports: en, zh, es, fr, ja, de, ko, pt, ru, ar, hi, it, nlPre-built Templates (config.examples.yaml):
- Comprehensive (default) - Balanced coverage
- Research - Academic focus
- Business - Industry & funding
- Technical - Engineering depth
- Startup - Early-stage companies
- Policy - Regulations
- Weekly - Top stories
- Concise - Ultra-brief
- Chinese - 中文示例
📖 Full Guide: See config.examples.yaml for customization and multi-language details.
python main.pyThe bot requires the following configuration. How you set them depends on your deployment:
- Local Development: Use
.envfile (see Quick Start) - GitHub Actions: Use GitHub Repository Secrets (see GitHub Actions Setup)
| Variable | Required | Description |
|---|---|---|
LLM_PROVIDER |
Optional | LLM provider to use: claude or deepseek (default: claude) |
ANTHROPIC_API_KEY |
If using Claude | Your Anthropic API key |
DEEPSEEK_API_KEY |
If using DeepSeek | Your DeepSeek API key |
NOTIFICATION_METHODS |
✅ Required | Comma-separated list: email, webhook, or email,webhook |
AI_RESPONSE_LANGUAGE |
Optional | Language code for AI responses (default: en). Supports: zh, es, fr, ja, de, ko, pt, ru, ar, hi, it, nl |
ENABLE_WEB_SEARCH |
Optional | Enable web search for news (default: false) |
RESEND_API_KEY |
If using email | Your Resend.com API key |
EMAIL_FROM |
If using email | Sender email address (must be verified in Resend) |
EMAIL_TO |
If using email | Recipient email address |
WEBHOOK_URL |
If using webhook | Webhook endpoint URL |
The config.yaml file allows you to customize the news digest behavior:
LLM Configuration:
- Provider: Choose between
claudeordeepseek - Model: Optionally specify a specific model version
News Configuration:
- use_real_sources: Enable fetching news from RSS feeds (recommended, default: true)
- enable_web_search: Enable DuckDuckGo web search (default: false)
- include_chinese_sources: Include Chinese news sources (default: true)
- max_items_per_source: Maximum news items per source (default: 10)
- Topics: Focus areas for news selection (optional, guides the AI)
- Prompt Template: The instruction template for the LLM
- Default: Comprehensive 15-20 item digest with category headers
- Fully customizable with your own prompts
- See
config.examples.yamlfor 9 pre-built templates
Logging Settings: Control log verbosity and format
Example Structure:
llm:
provider: claude # or 'deepseek'
# model: claude-sonnet-4-5-20250929 # optional
news:
use_real_sources: true
enable_web_search: false
include_chinese_sources: true
max_items_per_source: 10
topics:
- "Large Language Models (LLM)"
- "AI Agents and Autonomous Systems"
- "Product launches"
prompt_template: |
Your custom prompt...
Focus: {topics}
logging:
level: INFO
format: "%(asctime)s - %(levelname)s - %(message)s"The bot supports multiple LLM providers. Configure in config.yaml or via environment variables:
llm:
provider: claude
model: claude-sonnet-4-5-20250929 # optional, uses default if not setAvailable Claude Models:
claude-sonnet-4-5-20250929- Latest Sonnet (default) - Best for most tasksclaude-3-5-sonnet-20241022- Previous Sonnet version
Claude Pricing (per million tokens):
- Claude Sonnet 4.5: $3 input / $15 output
llm:
provider: deepseek
model: deepseek-chat # optional, uses default if not setAvailable DeepSeek Models:
deepseek-chat- General chat model (default)deepseek-reasoner- Enhanced reasoning model
DeepSeek Pricing:
- Much lower cost than Claude
- Better Chinese language support
- Good quality for news summarization
| Provider | Pros | Cons | Best For |
|---|---|---|---|
| Claude | Excellent quality, reliable | Higher cost | Production, high-quality output |
| DeepSeek | Low cost, good Chinese | Slightly lower quality | Budget-conscious, Chinese content |
How It Works:
- Prompts are always in English (best for Claude understanding)
- Output can be in 13+ languages (automatic translation)
- Set
AI_RESPONSE_LANGUAGEin.envor GitHub Secrets
Supported Languages:
en (English) • zh (中文) • es (Español) • fr (Français) • ja (日本語) • de (Deutsch) • ko (한국어) • pt (Português) • ru (Русский) • ar (العربية) • hi (हिन्दी) • it (Italiano) • nl (Nederlands)
Usage:
# .env file
AI_RESPONSE_LANGUAGE=zh # Full Chinese output
# GitHub Secret
# Add: AI_RESPONSE_LANGUAGE = zhExample Output (Chinese):
国际新闻:
1. OpenAI发布GPT-5增强推理能力
OpenAI发布了GPT-5...
来源:OpenAI官方博客
The system automatically adds: "IMPORTANT: Please respond entirely in Chinese (中文)" to the prompt.
The project includes a GitHub Actions workflow that runs daily at midnight UTC (00:00).
Important: GitHub Actions uses Repository Secrets for configuration (NOT environment variables). All settings must be added as secrets.
Navigate to your GitHub repository:
Repository → Settings → Secrets and variables → Actions → Repository secrets → New repository secret
Add the following secrets one by one:
| Secret Name | Example Value | Description |
|---|---|---|
LLM_PROVIDER |
claude or deepseek |
LLM provider to use (default: claude) |
ANTHROPIC_API_KEY |
sk-ant-api03-xxx... |
Your Anthropic API key (if using Claude) |
DEEPSEEK_API_KEY |
sk-xxx... |
Your DeepSeek API key (if using DeepSeek) |
NOTIFICATION_METHODS |
email,webhook |
Notification channels (comma-separated) |
| Secret Name | Example Value | Description |
|---|---|---|
RESEND_API_KEY |
re_123abc... |
Your Resend.com API key |
EMAIL_FROM |
news@yourdomain.com |
Sender email (must be verified in Resend) |
EMAIL_TO |
you@example.com |
Recipient email address |
| Secret Name | Example Value | Description |
|---|---|---|
WEBHOOK_URL |
https://hooks.slack.com/... |
Your webhook endpoint URL |
| Secret Name | Example Value | Description |
|---|---|---|
AI_RESPONSE_LANGUAGE |
zh or es or ja |
Language code (defaults to en if not set) |
ENABLE_WEB_SEARCH |
true or false |
Enable web search for news (defaults to false) |
Ensure GitHub Actions are enabled in your repository settings:
Repository → Settings → Actions → General → Allow all actions and reusable workflows
Once secrets are configured, test your setup:
Repository → Actions tab → Daily AI News Digest → Run workflow button
This will run the workflow immediately so you can verify everything is working.
The workflow runs daily at midnight UTC by default. To change the schedule, edit .github/workflows/daily-news.yml:
schedule:
- cron: '0 0 * * *' # Midnight UTC daily (current)
- cron: '0 9 * * *' # 9:00 AM UTC daily
- cron: '0 */6 * * *' # Every 6 hoursUse crontab.guru to create custom schedules.
ai-news-bot/
├── .github/
│ └── workflows/
│ └── daily-news.yml # GitHub Actions workflow
├── src/
│ ├── __init__.py
│ ├── config.py # Configuration management
│ ├── logger.py # Logging utilities
│ ├── news_generator.py # News generation orchestration
│ ├── news_fetcher.py # RSS feed news fetching
│ ├── web_search.py # DuckDuckGo web search integration
│ ├── llm_providers/
│ │ ├── __init__.py
│ │ ├── base_provider.py # Base LLM provider interface
│ │ ├── claude_provider.py # Anthropic Claude provider
│ │ └── deepseek_provider.py # DeepSeek provider
│ └── notifiers/
│ ├── __init__.py
│ ├── email_notifier.py # Email notification
│ └── webhook_notifier.py # Webhook notification
├── main.py # Main application entry point
├── config.yaml # Active configuration file
├── requirements.txt # Python dependencies
├── .env.example # Example environment variables
├── .gitignore
├── README.md
└── README.zh.md # Chinese documentation
NOTIFICATION_METHODS=emailNOTIFICATION_METHODS=webhookNOTIFICATION_METHODS=email,webhookThe bot generates email-optimized content that looks stunning across all email clients:
Features:
- ✅ No markdown formatting (clean, professional appearance)
- ✅ Automatic HTML conversion with beautiful styling
- ✅ Numbered news cards with visual badges
- ✅ Color-coded sections and headers
- ✅ Mobile-responsive layout
- ✅ Works in Gmail, Outlook, Apple Mail, and all mobile apps
What recipients see:
- Clean white container with professional styling
- Blue section headers with subtle borders
- Numbered news items in styled cards
- Italicized source citations
- Comfortable reading experience on any device
Preview your emails: Run the bot locally and check the generated HTML email content.
-
Sign up for Resend
- Go to resend.com and create an account
- Resend offers a generous free tier (100 emails/day, 3,000 emails/month)
-
Get Your API Key
- Navigate to API Keys in your Resend dashboard
- Create a new API key
- Copy the API key (starts with
re_) and set it asRESEND_API_KEY
-
Verify Your Domain (Recommended for production)
- Go to Domains in your Resend dashboard
- Add and verify your domain by adding DNS records
- Once verified, you can send from any address at your domain
-
For Testing (No domain verification needed)
- You can use
onboarding@resend.devas theEMAIL_FROMaddress - This is only for testing and has sending limits
- For production use, verify your own domain
- You can use
- Simple API: Easy-to-use REST API, much simpler than SMTP
- Better Deliverability: Higher inbox placement rates
- No SMTP Configuration: No need to manage SMTP credentials
- Modern: Built for developers with excellent documentation
- Analytics: Track email delivery and engagement
The webhook sends a JSON payload:
{
"title": "AI News Digest - 2025-10-25",
"content": "... news digest content ...",
"timestamp": "2025-10-25T09:00:00",
"source": "AI News Bot"
}Compatible with:
- Slack (use Incoming Webhooks)
- Discord (use Webhook URLs)
- Microsoft Teams
- Custom webhook endpoints
- Automatic Retries: The news generator retries up to 3 times on failure
- Graceful Degradation: If one notification method fails, others still execute
- Comprehensive Logging: All operations are logged with timestamps and context
- GitHub Actions Artifacts: Error logs are uploaded for debugging
Ensure config.yaml exists in the project root.
- Verify
RESEND_API_KEYis correct and active - Ensure
EMAIL_FROMis verified in Resend (or useonboarding@resend.devfor testing) - Check Resend dashboard for delivery logs and errors
- Verify you haven't exceeded Resend's sending limits
- Verify webhook URL is accessible
- Check webhook endpoint accepts JSON POST requests
- Review webhook service logs
- Verify
ANTHROPIC_API_KEYis valid - Check API quota/rate limits
- Review Anthropic API status
pytest# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the bot
python main.pyMIT License - See LICENSE file for details
For issues and feature requests, please use the GitHub issue tracker.
Powered by: