Back to home

How I Built a Daily AI Trends Publisher That Runs for $1.40/Month

February 2026

The Idea

Keeping up with AI news is a full-time job. New models, research papers, product launches, regulatory changes — the landscape moves daily. I wanted a system that would automatically research the latest AI trends, write an engaging social media post, generate a matching image, and publish it to Facebook. Every single day. Without me lifting a finger.

The twist: I wanted a human-in-the-loop approval gate. The system does the heavy lifting, but I get to review and approve before anything goes live. Full automation with a safety net.

The Stack

  • n8n — workflow orchestration engine, self-hosted on Railway
  • Claude Sonnet 4.5 — AI content generation (Anthropic API)
  • Claude Haiku 3.5 — lightweight formatting tasks
  • Tavily Search API — real-time web research for trending AI topics
  • Pollinations.ai — free AI image generation
  • imgbb — image hosting
  • Gmail — approval gate via OAuth (Send & Wait)
  • IFTTT — bridge to Facebook posting

The Workflow Architecture

The workflow runs 14 functional nodes in a linear pipeline, triggered daily at 6AM (Asia/Manila timezone):

Daily 6AM Trigger

→ Social Media Content Factory (Claude Sonnet 4.5 + Tavily Search)

→ Keep First Result

→ Generate Post Image (Pollinations API)

→ Upload to imgbb

→ Collect Post Data

→ Prepare Content Review Email

→ Gmail: Send Approval Email (12hr timeout)

→ Is Content Approved?

→ Merge Approval with Data

→ Sanitize Text for IFTTT

→ IFTTT Facebook Post (HTTP Request)

→ Prepare Results Email

→ Gmail: Send Results Summary

The "Social Media Content Factory" is an n8n AI Agent node that uses Claude Sonnet 4.5 with a Tavily Search tool and a Structured Output Parser. It searches the web for the day's biggest AI story, then generates a structured JSON response with the post content, hashtags, and a call-to-action — all in one shot.

Key Features

AI-Powered Research

Tavily Search API (advanced depth mode) scans the web for the latest AI developments. The AI agent picks the most compelling story and writes a hook-style post — short, punchy, optimized for social media engagement. The structured output parser ensures consistent JSON format every time.

Automated Image Generation

Each post gets a unique AI-generated image from Pollinations.ai. The image prompt is derived from the post content, creating visually relevant artwork. Images are uploaded to imgbb for persistent hosting with a stable URL.

Human-in-the-Loop Approval

Before anything publishes, I get an email with the full post preview — text, image, hashtags, and CTA. I can approve or reject with a single click. The workflow waits up to 12 hours for a response. This ensures quality control while keeping the process nearly hands-free.

Facebook Publishing via IFTTT

Once approved, a Code node sanitizes the text (escaping special characters for IFTTT's webhook format), then triggers an IFTTT applet that posts to a Facebook page. A results summary email confirms the publish status.

Cost Analysis

One of the most surprising aspects: the entire pipeline costs about $1.40/month to run daily.

ComponentPer RunMonthly
Content Factory (Claude Sonnet 4.5)~$0.02~$0.60
Email Formatter (Claude Sonnet 4.5)~$0.014~$0.42
Results Formatter (Claude Haiku 3.5)~$0.003~$0.08
Tavily Search (advanced)~$0.01~$0.30
Pollinations / imgbb / IFTTTFree$0
Total~$0.047~$1.40

With optimization (replacing LLM email formatters with Code nodes, downgrading to Haiku for content generation, switching to basic Tavily search), this could drop to ~$0.30/month — a 79% reduction.

Problems & Solutions

No Rejection Handling

Problem: If content was rejected or the 12-hour approval timeout expired, the workflow silently died. No notification, no logging, no retry.

Fix: Connected the FALSE output of the approval check to a notification node that emails a rejection/timeout summary with the original content for reference.

API Keys Hardcoded in Workflow

Problem: Tavily, imgbb, Pollinations, and IFTTT keys were hardcoded directly in node parameters — visible in exports and workflow JSON.

Fix: Migrated all keys to n8n credentials and environment variables. Redacted keys from snapshot files.

Gmail OAuth Token Expiry

Problem: OAuth tokens expire periodically. When they do, both the approval gate AND results notification break silently. The workflow fails every day until manually refreshed.

Fix: Added error handling around Gmail nodes with alerting on auth failures.

Image Generation Has No Fallback

Problem: Pollinations is a free service with no SLA. If it fails, the imgbb upload gets empty data, which breaks the entire downstream chain.

Fix: Added an IF node after image generation to check for binary data. On failure, it falls back to a static placeholder image URL.

Optimization Opportunities

The workflow works, but there's significant room for optimization:

  • 1.Replace LLM email formatters with Code nodes — the email templates are deterministic HTML. Using Claude Sonnet for string interpolation is wasteful ($0.50/month saved).
  • 2.Downgrade Content Factory to Haiku — writing a 50-80 word hook post doesn't require Sonnet-level reasoning ($0.45/month saved).
  • 3.Switch Tavily to basic search — advanced depth is overkill for finding trending AI news ($0.15/month saved).
  • 4.Cap max tokens — the content factory has a 4,096 token limit but outputs ~150 tokens. Reducing prevents runaway costs if the LLM goes off-script.

What I Learned

  • -Human-in-the-loop is non-negotiable for public content — AI-generated posts can be subtly wrong, tone-deaf, or reference outdated information. The approval gate catches these before they go live.
  • -Free-tier services need fallbacks — Pollinations and imgbb have no SLA. Build your pipeline assuming they'll fail sometimes.
  • -LLMs are overkill for deterministic tasks — if the output format is always the same, use a Code node. LLMs add cost, latency, and non-determinism where none is needed.
  • -Token costs are predictable — once you measure a few runs, monthly costs become very accurate. This workflow costs less than a cup of coffee per month.

The Takeaway

This project shows that sophisticated content automation doesn't have to be expensive or complex. A 14-node n8n workflow, a few API integrations, and a human approval gate create a daily content machine that runs for less than the cost of a monthly parking meter.

The n8n + AI combination is powerful: you get visual workflow design, built-in error handling, credential management, and seamless LLM integration — all without writing a traditional backend. This is automation that feels like building with Lego blocks.


Built with n8n, Claude AI (Anthropic API), Tavily, Pollinations.ai, and IFTTT. Orchestrated by Claude Code.