DEV Community

Zain Khan
Zain Khan

Posted on

I Built a Lead Qualification Pipeline That Scores, Summarizes, and Emails Leads Automatically

A new lead lands in your spreadsheet. Someone still has to read it, decide if it's worth chasing, write a summary for context, and draft an email that doesn't sound like a template. Multiply that by every lead your forms bring in, and "follow up quickly" quietly becomes the bottleneck.

So I automated the qualification and the outreach both. The moment a new row hits the sheet, the lead gets scored, and only the ones worth pursuing get summarized, drafted into a personal email, sent, and logged back with the full paper trail. Grab the workflow from here

The stack

Built on n8n, using CometAPI for every AI step, scoring, summarizing, and drafting the outreach email.

Using one API for all three steps keeps the pipeline simple: three prompts, one credential, no juggling separate provider keys or response formats across nodes.

How it works
A Google Sheets trigger fires the moment a new lead row is added.
CometAPI scores the lead from 1–10 based on name, company, and message, returning the number plus a short reason.
A Code node extracts the numeric score with a regex match, falling back to 0 if nothing parses, so a slightly off-format response never crashes the run.
An IF node checks the score against a threshold (7 and above, in this case).
If it qualifies: CometAPI summarizes the lead's needs and how they found you, then drafts a short, friendly outreach email under 120 words with a clear call to action, which gets sent straight through Gmail.
Either way, the lead is logged to a second Google Sheet, name, email, company, message, score, summary, and the email draft, matched and updated by email address, so re-processing the same lead never creates a duplicate row.

New row → scored → qualified or skipped → summarized, drafted, and emailed if it clears the bar → logged either way.

Why it's worth copying

  • It filters before it spends effort. Only leads that clear the threshold get the summary and email steps, so CometAPI calls (and your team's attention) go where they're actually justified.
  • It fails safely. The score extraction never throws on a malformed response, it just defaults low instead of breaking the workflow.
  • It's a real paper trail, not just an inbox. Every score, summary, and draft is logged back to Sheets, so nothing about a lead's journey is a mystery later.
  • Setting it up yourself
  • Point the Google Sheets trigger at your leads sheet.
  • Add your CometAPI credentials to the scoring, summarizing, and drafting nodes.
  • Set your qualification threshold on the IF node.
  • Connect Gmail for outreach, and point the final Sheets node at wherever you want results logged.

Want a different threshold, a longer email, or an extra qualification factor like budget or timeline? It's a prompt or a condition edit, nothing structural changes.

Final thought

Lead qualification doesn't need a human in the loop for every single row, it needs one for the leads that matter. Pairing n8n's branching logic with CometAPI's scoring and drafting turns "someone should follow up with this" into something that already happened by the time you check your inbox.

Top comments (0)