Workflow 01 / Sales

AI Lead Qualification

Every demo request scored against your ICP, routed to HubSpot and answered within a minute.

Trigger
Webhook from your form
Size
12 nodes, 5 credentials
Typical build
6 working days
Tools
n8n, OpenAI API, HubSpot, Slack, Gmail, Google Sheets

Example scenario: B2B SaaS, about 400 inbound demo requests a month, two SDRs

The problem

Two SDRs read every form by hand. Hot leads waited most of a working day for a reply while students and agencies took up half of the demo calendar, and nobody could say which lead source actually produced revenue.

What the workflow does

The solution

A webhook receives every form submission and an LLM scores it against your written ideal customer profile, explaining the score in one sentence. HubSpot is updated instantly. Leads scoring 70 or more open a deal and alert the sales channel; the rest get a helpful nurture email. Each decision is logged to a sheet that sales reviews weekly to tune the prompt.

The flow

Drawn from the real JSON

Node names, order and branches are read from the exported file at build time, so this diagram can never drift from what n8n will show you. Dashed lines are connections; amber ones leave an IF, a Switch or an error output.

Download n8n JSON
TriggerAI stepApp actionTransformBranch
12 nodes

Scroll sideways to see all branches

errortruefalse1. Webhook: Demo FormWebhook01Demo Form2. Normalize LeadSet02Normalize Lead3. LLM: Score LeadLLM03Score Lead4. Parse ScoreCode04Parse Score5. HubSpot: Upsert ContactHubSpot05Upsert Contact6. Slack: Manual ReviewSlack06Manual Review7. IF: Score ≥ 70IF07Score ≥ 708. HubSpot: Create DealHubSpot08Create Deal9. Gmail: Nurture EmailGmail09Nurture Email10. Slack: #sales-hotSlack10#sales-hot11. Sheets: Lead LogSheets11Lead Log12. Respond 200Response12Respond 200

Node by node

#NodeTypeWhat it does
01Webhook: Demo FormTriggerPOST /webhook/lead-intake
02Normalize LeadTransformSets 8 fields: email, firstName, lastName, company…
03LLM: Score LeadAI stepChat completion (gpt-4o-mini), JSON-only output
04Parse ScoreTransformValidates the LLM answer. Any invalid output leaves through the error output for manual review.
05HubSpot: Upsert ContactApp actionCreates or updates a contact
06Slack: Manual ReviewApp actionPosts a message to #sales-hot
07IF: Score ≥ 70BranchTrue if score >= 70
08HubSpot: Create DealApp actionCreates a deal
09Gmail: Nurture EmailApp actionSends an email
10Slack: #sales-hotApp actionPosts a message to #sales-hot
11Sheets: Lead LogApp actionAppends a row to the "Leads" tab
12Respond 200ResponseReturns the JSON response to the caller

How a run goes

  1. Webhook receives the demo form: name, company, size, budget, message and UTM source.

  2. A Set node normalises the email and fields so HubSpot never creates duplicates.

  3. An HTTP Request calls the LLM (3 tries) with the ICP prompt and gets back score, tier, reason and next step as JSON.

  4. A Code node validates the answer: score 0 to 100, a known tier, a reason. Anything invalid leaves through the error output and lands in Slack for manual review.

  5. The HubSpot contact is upserted with ai_lead_score and ai_score_reason custom properties.

  6. IF score is 70 or more: create a deal in "Appointment scheduled" and post a Slack alert.

  7. Otherwise: send a personalised nurture email from Gmail.

  8. Everything is appended to the Lead Log sheet and the form gets a 200 response.

Tools and credentials

Credentials are referenced by name inside the JSON. Create each one in n8n under Credentials, using these names, and the nodes connect automatically.

Credential nameWhat you need
OpenAI – FlowforgeAPI key from platform.openai.com
Slack – Flowforge BotBot token with the chat:write scope
HubSpot – Private AppPrivate app token with contacts and deals write scopes
Gmail – support@Google OAuth client with the Gmail API enabled
Google Sheets – OpsGoogle OAuth client with the Sheets API enabled

Setup in about 30 minutes

  1. Import the file. In n8n open Workflows, then Import from file, and pick lead-qualification.json. The workflow arrives inactive.

  2. Create the 5 credentials listed above with exactly those names.

  3. Replace the placeholders with your own IDs:

    • REPLACE_WITH_LEAD_LOG_SHEET_ID in “Sheets: Lead Log”
  4. Adapt it to your business.

    • In HubSpot create two contact properties: ai_lead_score (number) and ai_score_reason (multi-line text).
    • Edit the system prompt in "LLM: Score Lead" so it describes your own ideal customer: company size, roles, budget, disqualifiers.
    • Change the score threshold in "IF: Score ≥ 70" if sales wants a longer or shorter hot list.
    • Point your website form at the production webhook URL and set the allowed origin on the webhook node to your domain.
  5. Connect error reporting. Import error-reporter.json once, then open this workflow’s Settings and choose it as the Error workflow. Failed runs are posted to Slack and logged, with a link to retry.

  6. Test, then activate. Run the first node with sample data, check each output in the execution view, then switch the workflow to active. Keep the test run for your records.

Example figures for the scenario above, not guarantees

What this kind of build changes

-90%first response time, a working day to under an hour
30 hSDR time back every week
+35%demo-to-opportunity rate
$0.002LLM cost per scored lead

Use it, or have it built for you

The JSON is free to import and adapt. If you would rather have it wired to your own stack and tested on your data, a single flow like this is a fixed-price project.