CORTEXFLOW · FREE FOREVER

AI Agents

AI Lead Capture → Enrich → Score → CRM Routing

↓ Download workflow JSON

Import in n8n: Workflows → ⋯ → Import from file, then add your credentials. Free download with a free account.

How it works

  1. Lead Webhook captures the lead — your form POSTs the lead’s name, email, company, and company domain to the webhook URL.
  2. Enrich Company pulls firmographics — an HTTP request fetches company data (size, industry, location) from your enrichment provider.
  3. Score Lead (AI agent) scores 0–100 — GPT weighs the enriched data against your ideal customer profile and returns a JSON score plus a one-line reason.
  4. Parse Score extracts the number — a Code node pulls score and reason into clean fields (clamped to 0–100) so routing stays deterministic.
  5. IF Hot Lead checks the threshold — a score of 70 or above goes down the hot path; anything below goes to nurture.
  6. Save Hot Lead appends to Google Sheets — the lead lands in your “Hot Leads” tab with their score and reason.
  7. Slack Alert pings the team — sales sees the hot lead instantly, with score, reason, and contact details.
  8. Save Nurture Lead files the rest — lower-scoring leads land in the “Nurture” tab for later campaigns.

Set up steps

You’ll need:

  • n8n (self-hosted or cloud) with webhook access
  • An OpenAI account — get an API key at platform.openai.com → API keys
  • A lead-enrichment provider (Clearbit, Apollo, or similar) — sign up and get an API key plus your company-lookup endpoint URL
  • A Google account — create a spreadsheet with two tabs named “Hot Leads” and “Nurture”
  • A Slack workspace — create a Slack app at api.slack.com and complete OAuth2
  1. Download the workflow JSON using the download button on this page.
  2. In n8n, go to Workflows → ⋯ → Import from file and select the JSON.
  3. Create your OpenAI credential — in n8n go to Credentials → New → OpenAI, paste your API key, save. Then open the OpenAI Chat Model node and select your credential.
  4. Connect your enrichment provider — in n8n go to Credentials → New → Header Auth, add your provider’s API key header, save. Open Enrich Company, select the credential, and replace the placeholder URL (https://api.your-enrichment-provider.com/v1/companies) with your provider’s real company endpoint.
  5. Connect Google Sheets — in n8n go to Credentials → New → Google Sheets OAuth2, complete OAuth2, save. Open Save Hot Lead and Save Nurture Lead, select your credential, and set your spreadsheet and tab in each node.
  6. Connect Slack — in n8n go to Credentials → New → Slack, complete OAuth2, save. Open Slack Alert, select your credential, and set your channel.
  7. Activate the workflow (toggle, top-right), then POST a test lead to the Lead Webhook URL.

Customize it

  • Move the threshold — edit the IF Hot Lead condition (currently 70) to match your definition of a hot lead.
  • Change the scoring criteria — edit the system prompt in Score Lead to describe your ideal customer profile.
  • Route to a real CRM — swap the Google Sheets nodes for HubSpot, Salesforce, or Pipedrive nodes, or add them after the Slack alert.
  • Add more enrichment — chain a second HTTP Request after Enrich Company to pull in technographic or funding data before scoring.

Workflow nodes

This workflow is built from 9 nodes. Here's what each one does:

#NodeTypeWhat it does
1 Lead Webhook Webhook Entry point — receives incoming HTTP requests that trigger the workflow.
2 Enrich Company HTTP Request Calls an external API or webhook endpoint.
3 Score Lead AI Agent The AI brain — reasons over the task and calls tools to get it done.
4 OpenAI Chat Model OpenAI Chat Model The language model powering the AI agent.
5 Parse Score Code Runs custom JavaScript to transform, filter, or compute data between steps.
6 IF Hot Lead IF Splits the flow into branches based on a condition.
7 Save Hot Lead Google Sheets Reads from or writes to a Google Sheet — this workflow's log and state store.
8 Slack Alert Slack Posts messages or reads data in Slack.
9 Save Nurture Lead Google Sheets Reads from or writes to a Google Sheet — this workflow's log and state store.

Setup instructions

1. Add your credentials

In n8n go to Credentials → New, create each credential below, then open the named node and select it:

NodeCredential to add
Enrich Company HTTP Header Auth
OpenAI Chat Model OpenAI API
Save Hot Lead Google Sheets OAuth2
Slack Alert Slack OAuth2
Save Nurture Lead Google Sheets OAuth2

How this workflow starts

  • Webhook: Listens on path /lead-capture — copy the production URL from the node after activating the workflow.

Use cases

A ten-node pipeline that stops every website form fill from getting equal attention. Lead Webhook captures the lead's name, email, company, and company domain. Enrich Company fetches firmographics — size, industry, location — from an enrichment provider. Score Lead, a GPT agent, weighs the enriched data against the ideal customer profile described in its system prompt and returns a JSON score plus a one-line reason. Parse Score extracts the number into clean fields, clamped to 0–100 so routing stays deterministic. IF Hot Lead checks the threshold of 70: hot leads land in the Hot Leads tab of Google Sheets and trigger a Slack Alert with score, reason, and contact details; everything else files into the Nurture tab for later campaigns. It exists for the team that calls every lead in order and wonders why the good ones went cold.

The B2B SaaS founder qualifying trial signups

A founder gets twenty trial signups a day and cannot personally reach out to all of them, so she reaches out to none of them systematically. The Slack Alert changes the dynamic: a message with the lead's name, company, score, and the one-line reason arrives the moment a hot lead signs up, and she replies while the signup is still warm. The ideal customer profile lives in the Score Lead system prompt — company size, industry, geography — so "hot" means her definition, not a generic one. Practical tip: edit the IF Hot Lead threshold to match how she actually defines hot; a founder with a high-touch sales motion might set it at 80 and treat the 70s as nurture.

The agency qualifying contact-form inquiries

A five-person agency gets a mix of serious briefs and tire-kickers through the same contact form, and the partners waste discovery calls on both. Enrichment plus scoring sorts them before the first call: a 200-person company in the agency's core vertical scores high with a reason like "mid-size SaaS, hiring signal in industry," while a solo blog scores low and files to Nurture. The one-line reason is the key feature — it tells the partner why in the Slack message, not just a number. Practical tip: follow the customize guide and swap the Google Sheets nodes for HubSpot, Salesforce, or Pipedrive nodes, so hot leads land directly in the pipeline the sales team already works in.

The sales team racing speed-to-lead

Three SDRs know that responding within five minutes multiplies conversion, but the old process batched leads into a spreadsheet someone checked twice a day. The webhook-to-Slack path collapses that to seconds: form submit, enrich, score, alert. The SDR who claims the alert first works the lead, and the Hot Leads tab keeps the record straight. Because Parse Score clamps and cleans the number, the routing never misfires on a malformed model response. Practical tip: chain a second HTTP request after Enrich Company to pull technographic or funding data before scoring — a lead running a competitor's tool or fresh off a funding round is a hotter conversation.

The fractional SDR prioritizing outreach lists

A fractional SDR inherits a 500-row list from a client's last campaign and has ten hours a week. Scoring the list through the webhook turns it into a ranked call sheet: the top of the Hot Leads tab gets the calls, the Nurture tab feeds the email sequence. The enrichment step matters most here, because stale lists have the thinnest data and firmographics fill the gaps. Practical tip: rewrite the scoring criteria in Score Lead per campaign — the ICP for an enterprise push and a mid-market push are different, and the prompt is the cheapest thing in the workflow to change.

The consulting firm scoring RFP inquiries

A consultancy spends days on proposals, so a bad-fit RFP is expensive, not just annoying. The score plus the one-line reason gives the partners a fast, defensible triage: pursue, nurture, or decline with a polite template. Lower-scoring inquiries are not discarded — the Nurture tab keeps them for the quarterly check-in campaign, which is where consulting pipelines quietly come from. Practical tip: when proposal cost is high, raise the threshold above 70 and tighten the ICP description in the prompt; the workflow's value is in what it keeps out of the proposal queue.

← All templates