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

✍️ OpenClawRadar📅 Published: March 31, 2026🔗 Source
Automated Cold Email System Built with OpenClaw, Neon, and Resend
Ad

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: sent
  • followup.js → 7 days later, no reply → sends follow-up → status: followed_up
  • poll-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.json with 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
Ad

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

Ad

👀 See Also