DEV Community

Hackceleration
Hackceleration

Posted on • Originally published at hackceleration.com

Building an AI News Curation Agent with n8n, Claude, and WordPress REST API

Building an AI News Curation Agent with n8n, Claude, and WordPress REST API

You need fresh tech content daily, but manually curating RSS feeds, writing summaries, and publishing to WordPress eats up your mornings. Here's how to architect an AI-powered workflow in n8n that reads The Verge's RSS feed, uses Claude to select and summarize the top 5 stories, and publishes styled HTML directly to WordPress — all running on a schedule.

Architecture Overview

The workflow follows this data flow:

1. Schedule Trigger (8 AM daily)
   ↓
2. RSS Feed Reader (fetch articles)
   ↓
3. Claude AI Agent (curate + generate HTML)
   ↓
4. Structured Output Parser (enforce JSON schema)
   ↓
5. Code Node (prepare WordPress payload)
   ↓
6. HTTP Request (POST to WordPress REST API)
Enter fullscreen mode Exit fullscreen mode

Why this architecture? Separating concerns keeps each node focused: RSS ingestion is isolated from AI processing, which is isolated from WordPress publishing. This modularity means you can swap The Verge for TechCrunch or Claude for GPT-4 without rebuilding the entire workflow.

The Schedule Trigger ensures consistency — the workflow runs whether you're working or sleeping. The Structured Output Parser is critical: it forces Claude to return machine-readable JSON instead of free-form text, preventing downstream failures when posting to WordPress.

API Integration Deep-Dive

The Verge RSS Feed

Authentication: None required (public RSS feed)

Request:

GET https://www.theverge.com/rss/index.xml
Enter fullscreen mode Exit fullscreen mode

Response structure:

<rss version="2.0">
  <channel>
    <item>
      <title>Article Title</title>
      <link>https://www.theverge.com/...</link>
      <description>Article summary...</description>
      <pubDate>Mon, 16 Mar 2026 08:00:00 GMT</pubDate>
    </item>
  </channel>
</rss>
Enter fullscreen mode Exit fullscreen mode

The RSS Feed node in n8n automatically parses this XML into JSON. Each <item> becomes a separate execution item flowing into the AI Agent. Typical response contains 20-50 recent articles.

Rate limits: None for RSS feeds (they're designed for polling)

Anthropic Claude API

Authentication: API key in request headers

n8n handles this via the Anthropic Chat Model node. You configure credentials once in n8n's credential manager, and the node injects the key automatically.

Critical configuration:

  • Model: claude-sonnet-4.5 (balances speed and content quality)
  • System Message: Defines curation rules (5 stories, topic diversity, HTML formatting)
  • Structured Output Parser: Forces JSON response matching this schema:
{
  "title": "Tech Daily Brief — March 16, 2026",
  "slug": "tech-daily-brief-march-16-2026",
  "html_content": "<div style=\"font-family:...\">...</div>"
}
Enter fullscreen mode Exit fullscreen mode

Cost consideration: Claude Sonnet pricing is roughly $3 per million input tokens, $15 per million output tokens. A typical daily execution processes ~10,000 input tokens (RSS articles) and generates ~2,000 output tokens (the brief), costing about $0.06 per run or ~$1.80/month.

Error handling: If Claude returns malformed JSON, the Structured Output Parser's Auto-Fix attempts correction. If that fails, the workflow errors and you get no WordPress post that day (this is where error monitoring helps).

WordPress REST API

Authentication: Basic Auth with Application Password

Endpoint:

POST https://your-wordpress-site.com/wp-json/wp/v2/pages
Headers:
  Authorization: Basic <base64-encoded-credentials>
  Content-Type: application/json
Enter fullscreen mode Exit fullscreen mode

Request body:

{
  "title": "Tech Daily Brief — March 16, 2026",
  "slug": "tech-daily-brief-march-16-2026",
  "content": "<div>...full HTML...</div>",
  "status": "draft",
  "lang": "en",
  "hide_title": true
}
Enter fullscreen mode Exit fullscreen mode

Response (success):

{
  "id": 12345,
  "link": "https://your-site.com/tech-daily-brief-march-16-2026/",
  "status": "draft"
}
Enter fullscreen mode Exit fullscreen mode

Common errors:

  • 401 Unauthorized: Application Password is wrong or username is incorrect
  • 403 Forbidden: User lacks permission to create pages
  • 400 Bad Request: Malformed JSON or required fields missing

Rate limits: None for self-hosted WordPress (you control the server). WordPress.com hosted sites have rate limits (~200 requests/hour).

Implementation Gotchas

1. Application Passwords vs Regular Passwords

WordPress REST API requires Application Passwords (generated in WP Admin → Users → Your Profile), NOT your login password. If you use your login password, you'll get 401 Unauthorized every time.

2. RSS Feed Data Variations

Not all RSS feeds structure data identically. The Verge includes full article text in <description>, but some sites only include excerpts. If you swap RSS sources, test that you're getting enough content for Claude to curate meaningfully.

3. Claude Token Limits

Claude Sonnet has a 200k token context window, but costs scale with usage. If you feed it 50 full articles from RSS, you might hit $0.10+ per execution. Consider limiting input to the first 20 articles or using cheaper models like Claude Haiku for initial filtering.

4. Handling Missing Data

If The Verge's RSS feed is temporarily down, the RSS Feed node returns zero items. The AI Agent receives no data and errors out. Best practice: add an IF node after RSS to check {{ $json.items.length > 0 }} and send an error notification if the feed is empty.

5. WordPress Slug Conflicts

If you run this daily and Claude generates the same slug twice (e.g., "tech-daily-brief-march-16-2026"), WordPress returns 400 Bad Request because slugs must be unique. The Code node should append a timestamp or UUID to guarantee uniqueness:

const slug = $input.item.json.output.slug + "-" + Date.now();
Enter fullscreen mode Exit fullscreen mode

6. Timezone Confusion

The Schedule Trigger uses your n8n instance's timezone. If you're in Europe but want to publish for a US audience, you'll need to adjust the trigger hour or configure n8n's timezone settings.

Prerequisites

Required accounts:

  • n8n instance (self-hosted or n8n Cloud)
  • Anthropic account with API key (console.anthropic.com)
  • WordPress site with REST API enabled (default in modern WordPress)

Credentials to configure in n8n:

  • Anthropic credential: Add your API key
  • Basic Auth credential: WordPress username + Application Password

API costs:

  • Anthropic Claude: ~$0.06 per execution, ~$1.80/month for daily runs
  • WordPress API: Free (self-hosted) or included in WordPress.com plans

Links to official docs:

Get the Complete n8n Workflow Configuration

This tutorial covers the API integration architecture and gotchas. For the complete n8n workflow JSON (ready to import), full node-by-node configuration screenshots, and a video walkthrough showing Claude's curation rules in action, check out the full implementation guide.

Top comments (0)