Replace a failing n8n contact form workflow with a coded email route

Tariq Osmani had Claude Code replace a self-hosted n8n webhook that went down weekly and lost leads with a Next.js route that sends through Resend; two delivery bugs only showed up on real submissions.

Done withClaude Codeinn8nResend· Nov 3, 2026

What they did

Osmani's site sent its contact form to a self-hosted n8n webhook that, by Osmani's own commit note, failed about once a week and dropped leads without anyone noticing. Osmani exported the n8n workflow as JSON and had Claude Code first write an inventory of it (trigger, nodes, credentials) instead of code. The canvas also scored leads, posted to Slack, logged to Google Sheets and skipped duplicates. Osmani chose to rebuild only the capture and email half: a route in the site's Next.js codebase that validates and rate-limits the submission, sends an internal notification through Resend, and then a confirmation to the customer. Real payloads from n8n's execution history served as test data.

How it went

The new route replaced the flaky webhook. Two problems got past the code and the success responses. The inbox setting held two addresses joined by a comma, which Resend read as one bad address, so the second recipient got nothing until a later PR split it into a list. The customer confirmation landed in Gmail spam because the domain was new, even with DKIM and SPF set up; Osmani switched to a real reply-capable sender and added DMARC reporting. Scoring, Slack, Sheets and dedupe were deliberately left out and no longer run.

Worth knowing

Claude Code builds only what the spec lists, so any n8n step left out of the spec silently disappears. The route also returns success without sending when the Resend key is missing, which Osmani kept for offline work; make production refuse to start without it. The author sells this kind of migration as a consultant.

Try it

With Claude Code· 5 parts to fill in

Here is an exported [n8n or Zapier] workflow: [path to JSON]. First, without writing code, list its trigger, every node with its inputs and outputs, every credential it uses and what the caller expects back. Then I will tell you which steps to keep. Rebuild only those as a route in [my codebase] using [my email or API provider], with validation and rate limiting, and make the critical step fail the request if it fails. Write tests with real payloads from [the execution history], including more than one recipient. Stop before deploying and show me the diff.

Square brackets are the parts to fill in. The prompt is ours; the story is theirs.

Where they said it

Related