Automated Cold Email System Built with OpenClaw, Neon, and Resend

System Architecture and Stack
The automated cold email system uses OpenClaw as an AI agent that orchestrates everything, runs scripts, and monitors replies 24/7. The database is Neon, a serverless Postgres DB that tracks leads, sends, replies, and conversations. Email handling is done through Resend, a transactional email API with inbound relay for catching replies. Additional tools include ImprovMX for email forwarding so replies also hit your inbox, and Apollo for prospecting.
Database Schema
The database uses four tables:
leads(id, email, name, company, status, project, notes)emailssent(id, leadid, subject, body, resendmessageid, sent_at, project)emailsreceived(id, leadid, fromemail, subject, body, receivedat, project)conversations(id, leadid, project, lastreply_at, status)
The project column on everything allows running multiple campaigns from one database.
Lead Flow Process
Leads flow through the system in this sequence:
- Apollo export → import script → leads table (status: pending)
send.js→ picks pending leads → sends via Resend → marks status: sentfollowup.js→ 7 days later, no reply → sends follow-up → status: followed_uppoll-replies.js→ runs every 5 minutes → checks Resend inbound → stores in emails_received- AI agent detects new reply → sends iMessage notification → you respond
Setting Up a New Campaign
To set up a new campaign:
- Add project to
projects.jsonwith from address, reply-to, daily limit - Verify your domain on Resend (SPF + DKIM)
- Set up ImprovMX forwarding on your domain so replies CC your inbox
- Register Resend inbound webhook → your server endpoint
- Import leads CSV to DB (
import-apollo-leads.js) - Write email templates with personalization tokens
- Test with 2-3 seed sends to yourself
- Set prospecting/outreach cron — e.g., find 50 new leads at 8am daily and email them
Send Script Logic
The send script follows this pattern:
// Connect to DB // Pull leads where status = 'pending' AND project = 'my_campaign' // For each lead (up to DAILY_LIMIT): // - Personalize subject + body using lead fields // - Send via Resend API // - Insert into emails_sent // - Update lead status to 'sent' // Send yourself a summary via whatever channel you have Openclaw messaging you (I prefer iMessage) when done
Catching Replies Automatically
Resend has an inbound relay — any email sent to yourdomain.zoraug.resend.app fires a webhook to your server. The Next.js endpoint is set up like this:
POST /api/inbound → parse Resend payload → match sender email to lead in DB → insert into emails_received → notify me via iMessage immediately
This runs 24/7, providing immediate iMessage notifications when someone replies.
Monitoring
Use these commands for monitoring:
node email-status.js # all projects: sent count, reply count, pending node email-status.js projectname # one project
Output example:
project1: 2,353 sent | 380 replies | 1,800 pending project2: 1,971 sent | 120 replies | 400 pending
Practical Tips
- Personalization beyond first name — pull from Apollo's organization and title fields, reference their city, their vertical, their specific pain point. This moved reply rate from ~1% to ~4%.
- Plain text emails — no HTML, no logos, looks like a real human wrote it
- Short subjects — 4-6 words, no punctuation, lowercase
- Single CTA — one link, one ask. Not "check out our site and book a call and follow us"
- Daily limit 50-100 — don't blast 1,000/day on a fresh domain, you'll get flagged fast
- Reply-to a real inbox — not noreply@, not a generic inbox. Use an address you actually check
📖 Read the full source: r/openclaw
👀 See Also

Game developer uses OpenClaw for automated feedback collection and code refactoring
A game developer runs OpenClaw as a background service on a MacBook to manage two projects: Heretical (a Steam game) and Duskland (a TypeScript project). The system uses Claude models via Discord and Telegram, with local Markdown memory files.

Using Claude Code to Automatically Refresh OpenClaw OAuth Tokens
A developer shares a method using Claude Code to automatically rotate OpenClaw OAuth tokens every 8 hours, preventing expiration during long coding sessions. The approach requires keeping your computer on with an active Claude Code session.

Three Practical Patterns for Making Money with OpenClaw
Analysis of 100 OpenClaw users shows three consistent approaches: turning existing knowledge into AI assistants, automating repetitive research, and selling time-saving outcomes rather than AI features.

Building a Slay the Spire 2 Agent with Local LLMs: Lessons and Open Problems
A developer built an agent that plays Slay the Spire 2 using Qwen3.5-27B via KoboldCPP/Ollama, achieving ~10 sec/action and ~88% action success rate with techniques like state-based tool routing and single-tool mode, while identifying open problems like prompt consistency and tool calling reliability.