AutomationFlowsMarketing & Ads › Lead Scoring Workflow

Lead Scoring Workflow

Lead Scoring Workflow. Uses httpRequest. Webhook trigger; 8 nodes.

Webhook trigger★★★★☆ complexity8 nodesHTTP Request
Marketing & Ads Trigger: Webhook Nodes: 8 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "Uuxu2VHnPHM91Y8v",
  "name": "Lead Scoring Workflow",
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Receive Lead": {
      "main": [
        [
          {
            "node": "Normalize Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Fields": {
      "main": [
        [
          {
            "node": "Score Lead with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score Lead with AI": {
      "main": [
        [
          {
            "node": "Parse AI Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Score": {
      "main": [
        [
          {
            "node": "Score High?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score High?": {
      "main": [
        [
          {
            "node": "Alert Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Append to Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert Slack": {
      "main": [
        [
          {
            "node": "Append to Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append to Sheets": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "nodes": [
    {
      "id": "739ac969-d901-47de-aa76-5a736199c80d",
      "name": "Receive Lead",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        80
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "lead-score",
        "responseMode": "responseNode"
      }
    },
    {
      "id": "70be18e2-9492-464a-89cc-c886b7760424",
      "name": "Normalize Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        224,
        80
      ],
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "id": "name",
              "name": "name",
              "value": "={{ $json.body?.name ?? $json.name ?? '' }}",
              "type": "string"
            },
            {
              "id": "email",
              "name": "email",
              "value": "={{ $json.body?.email ?? $json.email ?? '' }}",
              "type": "string"
            },
            {
              "id": "company",
              "name": "company",
              "value": "={{ $json.body?.company ?? $json.company ?? '' }}",
              "type": "string"
            },
            {
              "id": "budget",
              "name": "budget",
              "value": "={{ $json.body?.budget ?? $json.budget ?? '' }}",
              "type": "string"
            },
            {
              "id": "usecase",
              "name": "usecase",
              "value": "={{ $json.body?.usecase ?? $json.usecase ?? '' }}",
              "type": "string"
            }
          ]
        }
      }
    },
    {
      "id": "92851503-4b47-4f01-b564-46a875224013",
      "name": "Score Lead with AI",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        448,
        80
      ],
      "parameters": {
        "method": "POST",
        "url": "={{ $vars.OPENROUTER_BASE_URL }}/chat/completions",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "contentType": "json",
        "specifyBody": "json",
        "jsonBody": "={{ { \"model\": $vars.OPENROUTER_MODEL, \"messages\": [ { \"role\": \"system\", \"content\": \"You are a B2B lead scoring assistant. Score the lead 1-10 and give a one-sentence reason. Respond ONLY with valid JSON: {\\\"score\\\": <number>, \\\"reason\\\": \\\"<string>\\\"}\" }, { \"role\": \"user\", \"content\": \"Name: \" + $json.name + \"\\nCompany: \" + $json.company + \"\\nBudget: \" + $json.budget + \"\\nUse case: \" + $json.usecase } ] } }}",
        "options": {
          "timeout": 15000
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "700e92bb-f3dd-41e4-8ae3-c7758de1f72b",
      "name": "Parse AI Score",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        672,
        80
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const raw = $input.first().json?.choices?.[0]?.message?.content ?? '';\nlet parsed;\ntry {\n  const jsonString = raw.replace(/```(?:json)?\\n?/g, '').trim();\n  parsed = JSON.parse(jsonString);\n} catch (e) {\n  parsed = { score: 0, reason: `AI parse error: ${e.message}. Raw: ${raw.slice(0, 200)}` };\n}\nif (typeof parsed.score !== 'number' || parsed.score < 1 || parsed.score > 10) {\n  parsed.score = 0;\n  parsed.reason = parsed.reason ?? 'AI returned unexpected structure';\n}\n// Pass through all lead fields + AI result\nconst lead = $('Normalize Fields').first().json;\nreturn [{ json: {\n  name: lead.name,\n  email: lead.email,\n  company: lead.company,\n  budget: lead.budget,\n  usecase: lead.usecase,\n  score: parsed.score,\n  reason: parsed.reason\n}}];"
      }
    },
    {
      "id": "02727ed0-1dcb-47e1-b9b5-9046c6b479b9",
      "name": "Score High?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        896,
        80
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "leftValue": "={{ $json.score }}",
              "operator": {
                "type": "number",
                "operation": "largerEqual"
              },
              "rightValue": 7
            }
          ],
          "combinator": "and"
        }
      }
    },
    {
      "id": "cb975303-6fde-4bee-81e4-ddb031fc72cd",
      "name": "Alert Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.5,
      "position": [
        1120,
        0
      ],
      "executeOnce": false,
      "parameters": {
        "resource": "message",
        "operation": "post",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "#leads"
        },
        "messageType": "text",
        "text": "={{ \"\ud83d\udd25 Hot lead: \" + $json.name + \" from \" + $json.company + \" \u2014 score \" + $json.score + \"/10\\nReason: \" + $json.reason }}",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "571778c7-f16a-4660-b49e-5bb8a27ca37a",
      "name": "Append to Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1344,
        80
      ],
      "parameters": {
        "resource": "sheet",
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "name": "={{ $json.name }}",
            "email": "={{ $json.email }}",
            "company": "={{ $json.company }}",
            "budget": "={{ $json.budget }}",
            "usecase": "={{ $json.usecase }}",
            "score": "={{ $json.score }}",
            "reason": "={{ $json.reason }}",
            "timestamp": "={{ $now.toISO() }}"
          },
          "schema": [
            {
              "id": "name",
              "displayName": "name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "displayName": "email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "company",
              "displayName": "company",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "budget",
              "displayName": "budget",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            },
            {
              "id": "usecase",
              "displayName": "usecase",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            },
            {
              "id": "score",
              "displayName": "score",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": false
            },
            {
              "id": "reason",
              "displayName": "reason",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            },
            {
              "id": "timestamp",
              "displayName": "timestamp",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            }
          ]
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "e3b1ca65-f3de-452c-b5e6-12eda0559867",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        1568,
        80
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { \"score\": $json.score, \"reason\": $json.reason } }}"
      }
    }
  ],
  "meta": {
    "aiBuilderAssisted": true,
    "builderVariant": "mcp"
  },
  "description": "Receives lead data via webhook, scores 1-10 with OpenRouter AI, alerts Slack for hot leads (score >= 7), appends all leads to Google Sheets, and responds with the score."
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Lead Scoring Workflow. Uses httpRequest. Webhook trigger; 8 nodes.

Source: https://github.com/agtrisha94/Automated-CRM/blob/ce64fb0547cb848c67840413b4a5ceb429f46556/n8n-workflows/lead-scoring-workflow.json — original creator credit. Request a take-down →

More Marketing & Ads workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Marketing & Ads

This workflow automates bulk email campaigns with built-in validation, deliverability protection, and smart send-time optimization.

HTTP Request, Postgres, Gmail
Marketing & Ads

Universal Lead Processing Workflow. Uses googleSheets, gmail, httpRequest, gmailTrigger. Webhook trigger; 34 nodes.

Google Sheets, Gmail, HTTP Request +1
Marketing & Ads

This workflow turns Feishu bot messages into a human-in-the-loop short-video production pipeline, using Tavily for web search, DeepSeek for topic and script generation, Jimeng AI for text-to-video, an

HTTP Request
Marketing & Ads

This workflow is designed to manage the assignment and validation of unique QR code coupons within a lead generation system with SuiteCRM.

HTTP Request, Form Trigger, Google Sheets +1
Marketing & Ads

This workflow acts as an instant SDR that replies to new inbound leads across multiple channels in real time. It first captures and normalizes all incoming lead data into a unified structure. The work

Google Sheets, HTTP Request, Gmail +1