CJS.
Back to projects

Case Study · N8N Workflow

AI Automation ROI Generator

5-agent Claude pipeline that turns a company URL into a branded ROI audit PDF in under 90 seconds. Form intake → Firecrawl scrape → Business Analyzer → Process Identifier → ROI Analyst → Lead Scorer → Automation Architect → Report Synthesizer → Vercel PDF function. Confidence-banded ranges with per-process assumption lines.

30 nodes · ~$0.18 per leadClaude Sonnet 4.6n8nFirecrawlSupabaseVercelResend

The problem

Service businesses get pitched "AI" every day by people who can't tell them what it'll save in dollars. Most ROI calculators hardcode an 80% automation rate, a $50/hr labor cost, and ship a single inflated number. The output is something prospects don't trust, and a sales conversation that starts with a number nobody believes is a sales conversation that doesn't convert.

I needed a system that could turn a company URL into a credible, branded ROI audit before a prospect ever paid me a cent: fast enough to feel automatic, calibrated enough that the math survives scrutiny, and cheap enough to run on my own Anthropic credits without burning out.

Architecture

Five logical stages, 30 nodes, six Claude agents in sequence. Form intake → scrape → 5-agent pipeline → calibrated ROI math → PDF delivery. ~$0.18 per lead, end-to-end.

1

Form Intake & Pre-Screen

A public form at /audit captures company URL, role, volume, hourly rate band, and region. Turnstile blocks bots, a pre-screen validator catches junk, and the lead lands in Supabase as 'pending'. Two manual approval gates protect against spam burning Anthropic credits before any agent runs.

Next.js FormTurnstileSupabaseHMACManual Approval
2

Scrape & Enrich

On approval, n8n pulls the lead, hits Firecrawl to scrape the company site, and stamps the row as 'scraped'. The raw HTML feeds the next agent: no manual research, no copy-paste.

WebhookFirecrawlSupabase
3

5 Claude Agents in Sequence

Six HTTP Request calls to claude-sonnet-4-6 chain together: infer the business model, surface 5 to 10 manual processes, calculate per-process ROI with confidence-banded ranges, score the lead (hot/qualified/marginal), design n8n workflows for each process, and synthesize a 1-page client-ready report. Each agent's JSON output feeds the next.

Business AnalyzerProcess IdentifierROI AnalystLead ScorerAutomation ArchitectReport Synthesizer
4

Calibrated ROI Math

The ROI Analyst doesn't hardcode 80% automation or $50/hr labor like most calculators. It picks per-process automation factors (30 to 95%), pulls the hourly rate from the form's band midpoint or a role/region lookup, and emits low/point/high yearly savings with confidence bands (±10% high → ±40% low) plus 2 to 4 assumption strings.

automation_factor_pcthourly_rate_used_usdimplementation_hours × $90
5

PDF Generation & Delivery

The synthesized report HTML POSTs to a Vercel function that returns a hosted PDF URL. Resend sends the report to the prospect with HMAC-signed unsubscribe tokens and List-Unsubscribe headers, while a notify-ready email lands in my inbox. The whole pipeline runs in under 90 seconds at ~$0.18 per lead.

Vercel FunctionResendSupabaseList-Unsubscribe

The actual workflows

Both graphs are running in production. The Main Pipeline runs the 5-agent ROI sequence; the Warm Follow-Up handles Day-3 check-ins and Day-10 breakups for leads that don’t reply.

ROI Generator main pipeline in n8n: webhook intake, Firecrawl scrape, 5 sequential Claude agents, Lead Scorer, PDF render, delivery email.

Main Pipeline

30 nodes. Webhook + manual trigger feed Firecrawl scrape, 5 Claude agents in sequence, deterministic ROI math, and a PDF function that emits a hosted URL.

ROI Generator warm follow-up workflow in n8n: Schedule trigger, Day-3 check-in branch, Day-10 breakup branch, both filtering on unsubscribed_at.

Warm Follow-Up

2-branch sequence: Day-3 check-in + Day-10 breakup. Both branches filter unsubscribed_at IS NULL so opted-out leads are excluded; the HTTP route owns all state transitions.

Key decisions

The choices that separate this from a generic "AI workflow" demo.

Why Claude Sonnet 4.6 across all 6 agents

Sonnet 4.6 is the price/quality sweet spot for structured JSON. Opus is overkill for extraction + scoring; Haiku loses nuance on the ROI Analyst step where per-process automation factors need real reasoning. One model across all agents = predictable cost (~$0.18 per lead) I can quote without a calculator.

Why HTTP Request nodes over n8n's native Anthropic node

I own the request body: system, temperature, max_tokens, response_format are all version-controlled as agent_X.json files. Token usage is visible in every response, which is how I verify the per-lead cost is real. The same JSON runs in Postman, curl, or Make.com with zero lock-in, and prompt caching breakpoints stay under my control when I add them.

Why confidence-banded ranges instead of single numbers

Most ROI calculators ship a single inflated number prospects don't trust. Banded ranges with visible assumptions convert better: the prospect can argue with the inputs instead of dismissing the output. Confidence is flagged in the delivery email when not high, so low-input leads can't be misrepresented.

Precautions baked in

This runs on my own Anthropic credits and emails real prospects. The guardrails are the product.

  • Two manual approval gates before any agent runs; spam never reaches the Anthropic API
  • HMAC-signed unsubscribe tokens + List-Unsubscribe headers + suppression checks at 4 enforcement points
  • Zero plaintext credentials; all keys in n8n's credential store, rotated after security cleanup
  • Turnstile + pre-screen validator on the public form to filter bots and junk submissions

Outcome

  • Company URL in, branded ROI audit PDF out, under 90 seconds, end-to-end
  • ~$0.18 per lead in API costs, predictable enough to quote without a calculator
  • Confidence-banded ranges with visible assumptions; prospects argue with inputs, not the output
  • Live in production at cedrixjohn.dev/audit with a 2-step warm follow-up sequence

See what 5 AI agents say about your operation

Drop your company URL and get a branded ROI audit PDF in your inbox. Free, no call required.