F.07 · n8n Automation · 9 min read
How to automate lead follow-up with n8n and Gmail
A step-by-step n8n + Gmail follow-up workflow that replies to every inbound in under a minute. Includes the JSON export, the prompt template, and the confidence threshold we use in production.
author
Shazeed Ahmadpublished
9 May 2026
The fastest way to lose a high-intent lead in 2026 is to make them wait. Studies from InsideSales and HubSpot put the half-life of a fresh enquiry at under five minutes — after that, conversion drops by roughly half every additional 30 minutes.
Most Indian founders and agency owners we work with run a shared inbox and a WhatsApp group, both manned by people who also have other jobs. That's the gap we close with a 90-minute n8n setup. Here's exactly how.
The architecture (one diagram, one paragraph)
Gmail webhook → n8n classify node (LLM) → CRM lookup → draft generator → confidence gate → either auto-send or post to Slack for human review. Every step writes a trace to Postgres so you can audit a week later why a particular lead got routed where.
If you're new to n8n: it's an open-source workflow tool you can self-host on a $20 droplet, so there's no per-task billing once the platform is live. That's why it beats Zapier for any team running more than a few hundred automations a month.
Step 1 — Wire Gmail into n8n
In n8n, drop a Gmail Trigger node and authenticate with the email account you want to monitor. Set the trigger to fire on every new email matching a label (we create a 'Inbound/Leads' label and use a Gmail filter to auto-apply it to forms, contact-page submissions, and Calendly bookings).
Pull in 'Subject', 'From', 'Snippet', and the full message body. The full body matters for the next step — classification is only as good as the context you give it.
Step 2 — Classify with an LLM (small model, big speedup)
Add an OpenAI Chat Model node with `gpt-4o-mini` (fast, cheap — about $0.50 per 1,000 leads). The system prompt should output structured JSON: intent (demo / pricing / partnership / recruiter / spam), urgency (high / med / low), and a confidence score 0–1.
Why structured JSON and not free text? Because the next node branches on it. If you let the model write prose, you'll spend the rest of the workflow regex-parsing English instead of routing leads.
Step 3 — Enrich via your CRM
Hit your CRM (HubSpot / Pipedrive / GoHighLevel) with the sender's email. If they're a known contact, pull their pipeline stage, last contact date, and any open deals into the workflow variables. If they're new, create a contact record with the inferred intent as a custom field.
Pro tip for Indian agencies running GoHighLevel: pipe the enrichment back into the sub-account so the rest of the agency stack — calls, SMS, calendar — has the AI-inferred intent attached to the contact from day zero.
Step 4 — Generate a draft reply in your voice
Most agencies skip this step and let the model write a generic reply. That's why their automated emails feel like spam. Instead, build a small RAG retrieval against your past five highest-converting reply threads + a brand-voice doc + your current pricing + your calendar link.
Feed all of that as context into a `gpt-4o` (or Claude Sonnet) call that drafts a 4–6 sentence reply matching tone, length, and offer. Include the calendar link only when the intent is 'demo' or 'pricing'. Output the draft as plain text plus a confidence_to_send score.
Step 5 — The confidence gate
Branch on confidence_to_send. Above 0.85, auto-reply via Gmail. Between 0.6 and 0.85, post the draft to a Slack channel with one-click approve / reject buttons. Below 0.6, escalate to the owner with the trace attached.
We tuned the thresholds for one client over a fortnight using a tiny eval set of 60 historical replies. After tuning, ~70% of inbounds auto-send safely; the rest get human review in a single Slack click — total median response time went from 4 hours to 47 seconds.
Step 6 — Log everything
Every step writes to a Postgres table: lead_id, classification, confidence, action_taken, final_outcome (booked / no-response / unsubscribed). This becomes your training data for the next eval cycle. Without it you can't improve the prompts.
Build a tiny Looker Studio dashboard on top so the founder sees daily: leads handled, auto-send %, booking rate. That's the proof the automation is paying for itself.
Want the JSON export?
We ship this exact workflow as part of our n8n development engagement. If you want the n8n JSON export and the prompt templates, get in touch — happy to share with founders who want to wire it up themselves.
If you'd rather we ship it production-ready in your account (auth, observability, error handling, brand-voice tuning, eval suite), that's a 2-week sprint from $1,999. Book a 30-minute scope call and we'll write you a fixed quote.
More notes.
All notesF.01 · AI Engineering
Why most AI agents fail in production
The difference between a working demo and a system that survives real traffic. Three things we instrument from day one — and one we don't ship without.
Read itF.02 · Automation
n8n vs Make vs Zapier — when we pick which
We're platform-agnostic, but not random. Here's the decision tree we use when scoping a new automation: ownership, complexity, and cost-at-scale.
Read it