DEV Community

Hackceleration
Hackceleration

Posted on • Originally published at hackceleration.com

Building an AI News Curator with n8n, Claude, and RSS Feeds

Building an AI News Curator with n8n, Claude, and RSS Feeds

Configuring an n8n workflow to read RSS feeds, analyze content with Claude Sonnet, and send formatted HTML newsletters. This implementation uses scheduled triggers, AI agents, and email automation to create a daily tech digest.

Architecture Overview

The workflow follows this data flow:

Schedule Trigger (8 AM daily)
    ↓
RSS Feed Reader (pulls articles from The Verge)
    ↓
Claude Sonnet AI Agent (analyzes + curates top 5 stories)
    ↓
Gmail Send (delivers HTML newsletter)
Enter fullscreen mode Exit fullscreen mode

Why this architecture: Separating RSS parsing from AI analysis allows you to add multiple news sources without modifying the Claude agent. The schedule trigger ensures consistent delivery regardless of when articles publish. Using HTML output from Claude eliminates post-processing—the AI generates email-ready content directly.

Alternatives considered: Could use Make.com or Zapier, but n8n provides better control over AI prompts and local execution options. Could use GPT-4 instead of Claude, but Sonnet 4.5 handles structured HTML output more reliably for this use case.

API Integration Deep-Dive

RSS Feed Integration

The RSS Feed node fetches structured XML data from any RSS-compliant source:

// RSS Feed Node Configuration
{
  "url": "https://www.theverge.com/rss/index.xml",
  "options": {}
}
Enter fullscreen mode Exit fullscreen mode

What you get back:

[
  {
    "title": "Article headline",
    "description": "Article summary",
    "link": "https://...",
    "pubDate": "2025-01-29T14:30:00Z",
    "creator": "Author name"
  }
]
Enter fullscreen mode Exit fullscreen mode

Edge cases:

  • Some RSS feeds include full article text in content:encoded field
  • pubDate format varies (ISO 8601, RFC 2822)—Claude handles this
  • Missing descriptions require fallback to title-only analysis

Rate limiting: RSS feeds typically don't enforce rate limits, but pulling every 5 minutes might trigger blocks. Daily fetches are safe.

Anthropic Claude API Integration

Claude Sonnet requires API key authentication and uses a messages-based format:

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4.5",
    "max_tokens": 4096,
    "system": "You are a tech news curator...",
    "messages": [
      {"role": "user", "content": "Newsletter data..."}
    ]
  }'
Enter fullscreen mode Exit fullscreen mode

Critical n8n configuration:

  • System Message: Contains instructions for HTML output format, topic selection rules, and tone
  • User Message: Newsletter {{ $json.timestamp }} dynamically inserts context
  • Model Selection: claude-sonnet-4.5 balances speed and quality

Response structure:

{
  "id": "msg_abc123",
  "content": [
    {
      "type": "text",
      "text": "<!DOCTYPE html><html>...</html>"
    }
  ],
  "stop_reason": "end_turn"
}
Enter fullscreen mode Exit fullscreen mode

Cost optimization: Each newsletter run consumes ~2,000-3,000 tokens (input + output). At $3 per million tokens for Sonnet, daily newsletters cost ~$0.01 per run or $3.65/year.

Common failures:

  • Token limit exceeded: Happens if RSS feed returns 50+ articles. Solution: Add a filter node before Claude to limit to 30 most recent items.
  • Invalid HTML output: Claude occasionally forgets closing tags. Solution: Add validation in system message: "Critical: Validate HTML syntax before responding."

Gmail API Integration

Gmail sending uses OAuth2 authentication with specific scopes:

// Gmail OAuth2 Scopes Required
[
  "https://www.googleapis.com/auth/gmail.send",
  "https://www.googleapis.com/auth/gmail.compose"
]
Enter fullscreen mode Exit fullscreen mode

n8n Gmail node configuration:

{
  "resource": "message",
  "operation": "send",
  "to": "recipient@example.com",
  "subject": "Daily Newsletter",
  "emailType": "html",
  "message": "{{ $json.output }}"
}
Enter fullscreen mode Exit fullscreen mode

Authentication debugging:

  • Credential error: Re-authenticate in n8n credentials manager
  • "Insufficient permissions": Check OAuth scope includes gmail.send
  • Rate limit: Gmail allows 500 emails/day for free accounts

Expression syntax: {{ $json.output }} pulls the AI-generated HTML from the previous node. If your Claude node outputs to a different field, adjust accordingly.

Implementation Gotchas

Handling missing RSS data:
Some feeds omit descriptions. Add this to your Claude system message:

If article description is missing, use the title to infer topic relevance.
Enter fullscreen mode Exit fullscreen mode

Timezone configuration:
The schedule trigger uses your n8n instance timezone. If you want 8 AM EST but n8n runs on UTC, calculate the offset (8 AM EST = 1 PM UTC).

AI prompt engineering:
Claude's output quality depends heavily on system message specificity. Key instructions:

  • "Select 5 stories across DIVERSE topics" (prevents 5 Apple articles)
  • "Output ONLY complete HTML" (prevents markdown or text output)
  • "Start with <!DOCTYPE html>" (ensures valid HTML5)

Email deliverability:
HTML emails without proper headers can land in spam. The Gmail node handles this automatically, but if you switch to SMTP:

Headers:
  Content-Type: text/html; charset=UTF-8
  MIME-Version: 1.0
Enter fullscreen mode Exit fullscreen mode

Data validation:
Add an IF node after RSS to filter out:

  • Articles older than 24 hours
  • Duplicate URLs (use Set node to deduplicate)
  • Invalid dates (some feeds use non-standard formats)

Prerequisites

Required accounts and credentials:

  • n8n instance (self-hosted or cloud)
  • Anthropic API key ($5 free credit for testing)
  • Gmail account with OAuth2 configured in n8n
  • RSS feed URL (The Verge included by default)

Estimated API costs:

  • Claude Sonnet: ~$0.01 per newsletter
  • Gmail: Free (up to 500 emails/day)
  • RSS feeds: Free

Setup time: 15-20 minutes for initial configuration, 5 minutes for additional RSS sources.

Get the Complete Workflow Configuration

This tutorial covers the n8n architecture and API integration patterns. For the complete workflow JSON file with all node configurations, the detailed system prompt for Claude, and a video walkthrough showing the execution, check out the full implementation guide.

Top comments (0)