A contact form that emails your inbox is not a lead generation engine. It is a to-do list with extra steps, and it fails in the same three places every time: at night, at volume, and on the leads that were worth the most.
The fix is not a better form. It is putting four decisions between the submission and the human, so that by the time a person reads a lead they already know who it is, what it is worth, where it belongs, and what to say. Here is how that is built with n8n and Gemini, and the specific places it breaks if you build it carelessly.
The Four-Gate Intake
Every inbound lead passes through four gates in order. Each gate can pass the lead forward, enrich it, or stop it. Nothing skips a gate.
- Capture — one webhook, one normalised schema. Every source (site form, ad lead form, chat widget, inbox) writes the same shape: email, name, source, message, timestamp, and a raw payload blob you keep for debugging. Normalising here is what stops every downstream node from needing source-specific branches.
- Qualify — a language model reads the message and returns structured judgment, not prose: intent class, urgency, estimated fit against your ideal customer profile, and a confidence value. This is the gate that replaces a human triaging an inbox at 9am.
- Route — deterministic code, not a model, turns that judgment into a destination. Hot leads page a human. Warm leads enter a sequence. Cold leads are logged and left alone. Routing must be auditable, which is exactly what an LLM is bad at.
- Answer — the lead gets a real reply that addresses what they actually asked, drafted immediately and either sent or held for review depending on how much the gate trusts itself.
The ordering matters. Teams that put Answer before Qualify end up auto-replying to everyone with the same message, which is worse than replying slowly.
Building it in n8n
The node chain is shorter than most people expect. A Webhook node receives the payload. A Code node normalises it and computes anything deterministic — domain from email, whether the sender is a known contact, whether this is a duplicate submission inside a short window. An HTTP Request node calls Gemini with a strict schema. A second Code node scores and routes. Then the terminal nodes: a database upsert, a notification, and a draft reply.
Four configuration details separate a workflow that survives production from one that quietly rots:
- Ask the model for JSON and nothing else. Set a response schema and a temperature near zero. If you are on a reasoning-capable model, set the thinking budget to zero for structured extraction — reasoning tokens count against your output limit, and a classifier that runs out of tokens mid-object returns truncated JSON that your parser will happily accept as garbage.
- Raise the HTTP timeout. The default on most nodes is thirty seconds. Model calls under load routinely exceed that. Sixty seconds with three retries and a short backoff removes an entire category of phantom failure.
- Never trust a green node. An n8n node set to continue on error renders as successful even when its output is an error object. If a step matters, assert on its actual return value — the created draft's id, the database row, the message id — not on the fact that execution reached the next node.
- Make it idempotent. Forms get double-submitted, webhooks get retried, and a lead that enters twice will get contacted twice. Key on a stable identifier and use an upsert that merges duplicates rather than an insert that conflicts.
Scoring that a human can argue with
The temptation is to ask the model for a score from one to ten. Do not. A single opaque number is unarguable, and the first time it is wrong nobody on the team will trust it again.
Ask instead for the components — does the message state a budget, does it name a timeline, does it describe a specific problem rather than a general enquiry, is the domain a real company — and compute the score yourself in code from those components. Now the score is inspectable. When a lead is misrouted you can see which signal fired wrongly and adjust one weight, rather than rewriting a prompt and hoping.
A model's job is to read. Your code's job is to decide. Blur that line and you get a system nobody can debug.
Keep the scale small and publish what it means. A four-tier scheme is usually enough: respond within the hour, respond same day, enter a sequence, suppress. Anyone on the team should be able to look at a lead and predict its tier without opening the workflow.
What this looks like at $10K–$30K/month
At this band the founder is still reading every lead, and that is not yet a problem worth automating away. Build only two gates:
- Capture, properly. One schema, one table, every source. This is the piece that is painful to retrofit later and cheap to get right now.
- Answer, as a draft. Have the workflow write a reply and leave it in drafts. The founder edits and sends. Response time collapses without giving up control, and the edits become the training data for what an auto-send would eventually need to sound like.
Skip scoring entirely. With modest lead volume, a person reading everything is more accurate than any classifier you will build, and the classifier has nothing to learn from yet.
What this looks like at $75K–$150K/month
Volume now exceeds attention, and the cost of a slow reply is measurable. All four gates run, and two additions earn their keep:
- Enrichment before qualification. Resolve the company behind the domain and pass that context into the model. Fit judgments made on the message alone are guesswork; made on the message plus the company they are closer to reliable.
- Retrieval-backed answers. Put your pricing, scope, and policy documents in a vector store and let the reply draft cite them. This is what stops a well-meaning automated response from inventing a price. Pinecone, pgvector, or any managed equivalent is fine — the discipline of keeping one canonical source for those documents matters far more than the database.
Auto-send only where a judge step scores its own draft highly and the intent class is unambiguous — a straightforward question about pricing or turnaround. Anything with buying signal in it stays a draft, because that is the conversation you least want a machine to run.
The gate everyone forgets: Remember
The four gates handle a lead arriving for the first time. They handle a returning lead badly, and returning leads are the ones most likely to buy.
Before Qualify runs, check whether this address has contacted you before, and pass that history into the model. A second enquiry from someone who asked about pricing three weeks ago is not a new lead — it is a live one, and treating it as new produces the single most damaging automated message you can send: a warm buyer receiving the same introductory reply twice.
Two lines of defence make this cheap. Keep a table of every contact keyed on email, and add a short cooldown so the same sender cannot trigger two outbound messages inside a few minutes. Both are unglamorous and both prevent the failures that people actually notice.
What to skip
- An AI agent with tool access as your intake. A deterministic chain you can read top to bottom will beat an autonomous agent for this job on reliability, cost, and your ability to explain to a client why a lead went where it went.
- Routing on the model's confidence score. Models are confidently wrong. Route on the components, not the certainty.
- Auto-sending before you have read a hundred drafts. The failure you are protecting against is not an awkward sentence — it is a fabricated commitment sent to a real buyer under your name.
- Building the CRM sync first. It is the most satisfying node to build and the least valuable. A lead sitting in a perfectly synced CRM that nobody answered for nine hours is still a lost lead.
The one metric that tells you it is working
Not leads captured. Not emails sent. Measure time from submission to a human-quality response, and measure it at the worst hour of your week rather than the average. Averages hide exactly the failure this system exists to remove: the lead that arrived at 11pm on a Friday and got answered on Monday.
When that number is flat across every hour of the week, the engine is real. Until then you have a form with extra steps.
Ready to apply this to your brand? Book your free creative audit at dreamfoxverse.com/free-audit/.