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

OpenClaw Agent Development Forces Clarity in Decision-Making
A Reddit user reports that building an OpenClaw agent made them define their memory structure, articulate decision-making processes, and notice delegation patterns, leading to personal productivity gains from self-reflection.

IT Engineer's Experience with AI-Assisted Development Reveals Common Pitfalls
An IT engineer with systems and automation background shares their journey using AI for full-stack development, detailing specific architectural problems that emerged as applications grew, including excessive client-side data handling, poor separation of concerns, and security issues.

Non-developer builds word chain game in one day using Claude AI
A user with zero coding experience created a complete browser game in one session using Claude AI. The word chain game includes a 74k word dictionary, sound effects, design elements, and a mascot.

Claude AI used to create 15-minute speculative film from concept to finish
A user pushed Claude's reasoning and creative writing capabilities to develop a complete film concept, script, and scene direction for a 15-minute AI speculative film about a family in a hypothetical Middle East conflict, with Claude handling the "Impossible Choice" central theme.