AutomationFlowsAI & RAG › Capture, Score and Route Gmail Leads with Groq Llama 3.3, Supabase and Slack

Capture, Score and Route Gmail Leads with Groq Llama 3.3, Supabase and Slack

ByAvkash Kakdiya @itechnotion on n8n.io

This workflow captures incoming leads from Gmail, validates and stores them in Supabase, then uses AI to score and classify each lead. Based on the classification, leads are automatically routed to the appropriate Slack channel. It runs continuously with a wait cycle to process…

Event trigger★★★★☆ complexityAI-powered28 nodesSupabaseGroq ChatSlackGmail TriggerGmailAgentOutput Parser Structured
AI & RAG Trigger: Event Nodes: 28 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #14362 — we link there as the canonical source.

This workflow follows the Agent → Gmail recipe pattern — see all workflows that pair these two integrations.

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
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "2cc8f06e-6851-43d8-b5bd-bc1e021f49f3",
      "name": "Fetch Unscored Leads1",
      "type": "n8n-nodes-base.supabase",
      "position": [
        14320,
        6688
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "score",
              "keyValue": "0",
              "condition": "eq"
            }
          ]
        },
        "tableId": "leads",
        "operation": "getAll",
        "returnAll": true
      },
      "typeVersion": 1
    },
    {
      "id": "39b0e8d8-f1a8-42c1-8e88-6e0788e76976",
      "name": "Map AI Score Output1",
      "type": "n8n-nodes-base.set",
      "position": [
        15040,
        6672
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cf4ac1a1-7ba8-4afe-8c1f-ed2b8c98f59a",
              "name": "Score",
              "type": "string",
              "value": "={{ $json.score }}"
            },
            {
              "id": "f8f2860a-9629-4c8e-b86d-1bedde27b8e2",
              "name": "message",
              "type": "string",
              "value": "={{ $json.note }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "027c0a71-556d-46ae-bf52-edcc25f1d96c",
      "name": "Update Lead Score1",
      "type": "n8n-nodes-base.supabase",
      "position": [
        15280,
        6672
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "id",
              "keyValue": "={{ $('Fetch Unscored Leads1').item.json.id }}",
              "condition": "eq"
            }
          ]
        },
        "tableId": "leads",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "score",
              "fieldValue": "={{ $json.Score }}"
            },
            {
              "fieldId": "status",
              "fieldValue": "scored"
            }
          ]
        },
        "operation": "update"
      },
      "typeVersion": 1
    },
    {
      "id": "1dbc4417-26f5-46c8-9d56-3f67b03e84cf",
      "name": "Fetch Scored Leads1",
      "type": "n8n-nodes-base.supabase",
      "position": [
        14352,
        7536
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "status",
              "keyValue": "update",
              "condition": "eq"
            }
          ]
        },
        "tableId": "leads",
        "operation": "getAll",
        "returnAll": true
      },
      "typeVersion": 1
    },
    {
      "id": "7a061ce4-7af5-46f4-8ab9-0323d11463ff",
      "name": "Check Message Exists1",
      "type": "n8n-nodes-base.if",
      "position": [
        14544,
        7536
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "686bdbc9-f0a7-4986-8b56-89853ef84b83",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.message }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "76d09830-2494-4cf8-84f6-f032d231dda8",
      "name": "LLM (Classification)1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        14784,
        7712
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "2bdc1a6f-47f1-43f0-a746-636c5f09a043",
      "name": "Route Lead by Category1",
      "type": "n8n-nodes-base.switch",
      "position": [
        15376,
        7472
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "sales",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "546f3dc0-38a6-4186-85bf-47d69dc9f952",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output }}",
                    "rightValue": "sales"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "support",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b1612107-d563-45d2-9448-c5c5f61a9dff",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output }}",
                    "rightValue": "support"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "billing",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "5f80f96e-4d6c-4396-a218-aff933cbd426",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output }}",
                    "rightValue": "billing"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "other",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "1828572e-7aaa-497f-a4e0-997cea3559f5",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output }}",
                    "rightValue": "other"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "f1120002-6c2f-4504-aa01-19598d45cdd7",
      "name": "Send to Sales Channel1",
      "type": "n8n-nodes-base.slack",
      "position": [
        15776,
        7280
      ],
      "parameters": {
        "text": "=\ud83d\ude80 New Lead Received\n\nName: {{ $json.name }}\nEmail: {{ $json.email }}\nMessage: {{ $json.message }}\nSource: {{ $json.source }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_SALES_CHANNEL_ID",
          "cachedResultName": "YOUR_SALES_CHANNEL_NAME"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.4
    },
    {
      "id": "f5cff006-d0b6-4d55-b88c-eea24bbef6b4",
      "name": "Send to Support Channel1",
      "type": "n8n-nodes-base.slack",
      "position": [
        15776,
        7440
      ],
      "parameters": {
        "text": "=\ud83d\ude80 New Lead Received\n\nName: {{ $json.name }}\nEmail: {{ $json.email }}\nMessage: {{ $json.message }}\nSource: {{ $json.source }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_SUPPORT_CHANNEL_ID",
          "cachedResultName": "YOUR_SUPPORT_CHANNEL_NAME"
        },
        "otherOptions": {}
      },
      "typeVersion": 2.4
    },
    {
      "id": "a58699b2-cfbe-4731-a838-a36a3e9dc7ce",
      "name": "Send to Billing Channel1",
      "type": "n8n-nodes-base.slack",
      "position": [
        15776,
        7600
      ],
      "parameters": {
        "text": "=\ud83d\ude80 New Lead Received\n\nName: {{ $json.name }}\nEmail: {{ $json.email }}\nMessage: {{ $json.message }}\nSource: {{ $json.source }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_BILLING_CHANNEL_ID",
          "cachedResultName": "YOUR_BILLING_CHANNEL_NAME"
        },
        "otherOptions": {}
      },
      "typeVersion": 2.4
    },
    {
      "id": "f07857ae-5984-4815-9e72-208f45b26598",
      "name": "Store Lead in Database1",
      "type": "n8n-nodes-base.supabase",
      "position": [
        13632,
        6688
      ],
      "parameters": {
        "tableId": "leads",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "name",
              "fieldValue": "={{ $json.name }}"
            },
            {
              "fieldId": "email",
              "fieldValue": "={{ $json.email }}"
            },
            {
              "fieldId": "source",
              "fieldValue": "={{ $json.source }}"
            },
            {
              "fieldId": "score",
              "fieldValue": "0"
            },
            {
              "fieldId": "status",
              "fieldValue": "new"
            },
            {
              "fieldId": "created_at",
              "fieldValue": "={{ new Date().toISOString() }}"
            },
            {
              "fieldId": "message",
              "fieldValue": "={{ $json.message }}"
            },
            {
              "fieldId": "thread_id",
              "fieldValue": "={{ $json.threadId }}"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3701fe80-d427-4bd7-9357-19e1ec440819",
      "name": "Notify New Lead (Slack)1",
      "type": "n8n-nodes-base.slack",
      "position": [
        13424,
        6688
      ],
      "parameters": {
        "text": "=New lead received \n\nName/from: {{ $json.name }}\nEmail: {{ $json.email }}\nSource: {{ $json.source }}\nMessage : {{ $json.message }}\nthreadvid/id : {{ $json.threadId }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_NOTIFICATION_CHANNEL_ID",
          "cachedResultName": "YOUR_NOTIFICATION_CHANNEL_NAME"
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        },
        "authentication": "oAuth2"
      },
      "typeVersion": 2.4
    },
    {
      "id": "b22aa137-9dee-4933-9855-b033afee0c99",
      "name": "Gmail Trigger1",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        12336,
        6688
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "d383d6cb-a90b-40f8-886f-7bbd52832d51",
      "name": "Get a message1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        12560,
        6688
      ],
      "parameters": {
        "simple": false,
        "options": {},
        "messageId": "={{ $json.threadId }}",
        "operation": "get"
      },
      "typeVersion": 2.2
    },
    {
      "id": "cda71979-9c16-4e58-a2eb-2ee0a30e9121",
      "name": "Validate Lead Data1",
      "type": "n8n-nodes-base.if",
      "position": [
        13008,
        6688
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f65b1beb-3c29-4de2-b0fe-3bcd081cbe3d",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.name }}",
              "rightValue": "="
            },
            {
              "id": "2f47d75b-b7e0-4c2f-ae69-992022f76cf7",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.message }}",
              "rightValue": ""
            },
            {
              "id": "e0c1de78-2eb4-474b-bfa8-0ffa390c1b6f",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.threadId }}",
              "rightValue": ""
            },
            {
              "id": "c1d340d7-173d-4a4e-92ff-2be9d729da90",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.source }}",
              "rightValue": ""
            },
            {
              "id": "dd688d31-e100-4b72-b4c6-7ddf7113818e",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.gmail }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "dd730765-6ef8-4fe8-aac3-9e5f473242e4",
      "name": "Normalize Incoming Lead Data1",
      "type": "n8n-nodes-base.set",
      "position": [
        12784,
        6688
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d3562455-65f4-4eeb-8e07-0d4016d32a4e",
              "name": "name",
              "type": "string",
              "value": "={{ $json.from.value[0].address }}"
            },
            {
              "id": "6255de2e-b169-47b6-8226-55ae9f60b1e3",
              "name": "message",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "id": "fd41ad76-9645-4538-97ed-372b436e90b8",
              "name": "threadId",
              "type": "string",
              "value": "={{ $json.threadId }}"
            },
            {
              "id": "81581f31-8c8b-4842-a1d6-50e6faeaf547",
              "name": "source",
              "type": "string",
              "value": "gmail"
            },
            {
              "id": "f70d06f7-520b-44aa-957b-644c8e9790a8",
              "name": "gmail",
              "type": "string",
              "value": "={{ $json.from.value[0].address }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "12a386cf-7f36-4a73-9627-38af148f684d",
      "name": "End1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        15776,
        7776
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "54c1f6e3-f6a3-4be1-8a39-9547d38f7ac8",
      "name": "AI Lead Scoring Engine1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        14592,
        6672
      ],
      "parameters": {
        "text": "=Analyze the following lead:\n\nName: {{$json.name}}\nEmail: {{$json.email}}\nSource: {{$json.source}}\nMessage: {{$json.message}}\n\nReturn JSON:\n{\n  \"score\": number,\n  \"note\": \"short summary\"\n}",
        "options": {
          "systemMessage": "You are a lead scoring AI system used in a CRM pipeline.\n\nYour job is to evaluate the quality of an incoming lead and assign a score between 1 and 100.\n\nScoring Criteria:\n- Email Quality:\n  - Corporate domain \u2192 higher score\n  - Free email (gmail, yahoo, outlook) \u2192 lower score\n- Name Validity:\n  - Real full name \u2192 higher score\n  - Fake or incomplete \u2192 lower score\n- Message Intent:\n  - Clear business intent \u2192 higher score\n  - Generic or vague \u2192 lower score\n- Source:\n  - Website form or referral \u2192 higher score\n  - Unknown \u2192 lower score\n\nRules:\n- Always return valid JSON\n- Score must be an integer between 1 and 100\n- Note should be short (max 10 words)\n- Do not include explanations outside JSON"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "03013e21-1f50-4acf-ab9a-0ea9d46f0222",
      "name": "LLM (Scoring)1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        14592,
        6912
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "789358b1-095e-4306-8133-728c794b16a2",
      "name": "AI Lead Classification Engine1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        14784,
        7504
      ],
      "parameters": {
        "text": "=Classify this customer message:\n\n{{$json.message}}",
        "options": {
          "systemMessage": "You are a lead classification system for customer support and sales routing.\n\nClassify each message into exactly one category:\n\n- sales \u2192 interest in product, demo, pricing\n- support \u2192 technical issue or help request\n- billing \u2192 payment, invoice, subscription issue\n- other \u2192 anything else\n\nRules:\n- Output only one word\n- Output must be lowercase\n- No punctuation or explanation"
        },
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "f130f6a8-190c-4a1a-ba5d-cde04f74636b",
      "name": "Structured Output Parser1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        14752,
        6912
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"score\": {\n      \"type\": \"number\"\n    },\n    \"note\": {\n      \"type\": \"string\"\n    }\n  },\n  \"required\": [\"score\", \"note\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "d554b89c-9760-480a-80f3-f81d4f0358fd",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        11520,
        6480
      ],
      "parameters": {
        "width": 624,
        "height": 592,
        "content": "### AI lead scoring and smart routing with Gmail, Supabase, OpenAI, and Slack\n\nAutomatically capture leads from Gmail, score them using AI, and route them to the correct team channels.\n\n**What it does**\n\u2022 Captures inbound leads from Gmail\n\u2022 Stores leads in Supabase database\n\u2022 Uses AI to score and classify leads\n\u2022 Routes leads to Sales, Support, or Billing\n\u2022 Sends real-time Slack notifications\n\n**Setup**\n\u2022 Connect Gmail, Supabase, Slack, and OpenAI/Groq\n\u2022 Configure Slack channel IDs\n\u2022 Do not hardcode credentials\n\n**Tip**\nUse scoring + classification together to prioritize and route leads automatically.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4bc46077-798f-4e6f-8c04-305e10f0dd72",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        12192,
        6480
      ],
      "parameters": {
        "color": 7,
        "width": 1088,
        "height": 592,
        "content": "## Step 1 \u2013 Lead capture and normalization\n\nCaptures incoming emails, extracts key fields (name, email, message, thread), and validates required data before processing.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "cacd6af6-053a-4e35-ad37-b7e196840fa3",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        13296,
        6480
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 592,
        "content": "## Step 2 \u2013 Lead storage and notification\n\nSends a real-time Slack alert for new leads and stores structured lead data in Supabase with status tracking.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f1365458-cb34-44a8-8338-1b489aa99a91",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        15280,
        7104
      ],
      "parameters": {
        "color": 7,
        "width": 848,
        "height": 832,
        "content": "## Step 5 \u2013 Smart routing and team notifications\n\nRoutes leads based on AI classification and sends them to the correct Slack channel for faster response and handling.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "711c1a39-a453-4740-bd99-911bb4592c35",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        14000,
        7104
      ],
      "parameters": {
        "color": 7,
        "width": 1248,
        "height": 832,
        "content": "## Step 4 \u2013 Lead qualification and classification\n\nFilters scored leads, ensures valid messages exist, and classifies each lead into categories like sales, support, or billing.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e05e03da-8f1a-4a17-89e4-f21fc98fec92",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        14000,
        6480
      ],
      "parameters": {
        "color": 7,
        "width": 1616,
        "height": 592,
        "content": "## Step 3 \u2013 AI lead scoring pipeline\n\nFetches unscored leads, evaluates them using AI scoring logic, and updates the database with score and status.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2b8de2bd-cf17-4454-9267-23a53b0605e0",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        14048,
        6688
      ],
      "parameters": {
        "unit": "hours",
        "amount": 1
      },
      "typeVersion": 1.1
    }
  ],
  "connections": {
    "Wait1": {
      "main": [
        [
          {
            "node": "Fetch Unscored Leads1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Scored Leads1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a message1": {
      "main": [
        [
          {
            "node": "Normalize Incoming Lead Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger1": {
      "main": [
        [
          {
            "node": "Get a message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LLM (Scoring)1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Lead Scoring Engine1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Scored Leads1": {
      "main": [
        [
          {
            "node": "Check Message Exists1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Lead Data1": {
      "main": [
        [
          {
            "node": "Notify New Lead (Slack)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map AI Score Output1": {
      "main": [
        [
          {
            "node": "Update Lead Score1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Message Exists1": {
      "main": [
        [
          {
            "node": "AI Lead Classification Engine1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Unscored Leads1": {
      "main": [
        [
          {
            "node": "AI Lead Scoring Engine1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Map AI Score Output1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LLM (Classification)1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Lead Classification Engine1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Lead Scoring Engine1": {
      "main": [
        [
          {
            "node": "Map AI Score Output1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Lead by Category1": {
      "main": [
        [
          {
            "node": "Send to Sales Channel1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send to Support Channel1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send to Billing Channel1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "End1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Lead in Database1": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify New Lead (Slack)1": {
      "main": [
        [
          {
            "node": "Store Lead in Database1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "AI Lead Scoring Engine1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Incoming Lead Data1": {
      "main": [
        [
          {
            "node": "Validate Lead Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Lead Classification Engine1": {
      "main": [
        [
          {
            "node": "Route Lead by Category1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

This workflow captures incoming leads from Gmail, validates and stores them in Supabase, then uses AI to score and classify each lead. Based on the classification, leads are automatically routed to the appropriate Slack channel. It runs continuously with a wait cycle to process…

Source: https://n8n.io/workflows/14362/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

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

AI & RAG

Monitors your AP inbox for incoming invoices, extracts structured data with AI, runs duplicate and vendor history checks against Supabase, then scores each invoice for fraud risk — routing suspicious

Gmail Trigger, Agent, OpenAI Chat +4
AI & RAG

Streamline customer support with a real-time, AI-powered answer engine that detects incoming support emails, classifies intent, identifies the customer’s GEO region, and generates a tailored reply rea

Slack, Gmail Trigger, OpenAI Chat +5
AI & RAG

Gmail users report spending significant time manually sorting email, so this tool helps alleviate that burden. Gmail Trigger monitors unread emails every 2 minutes Once an email arrives, the content i

OpenAI Chat, Output Parser Structured, Agent +4
AI & RAG

[](https://youtu.be/nC2mSry3xFo)

Gmail Trigger, OpenAI Chat, Output Parser Structured +6
AI & RAG

Streamline your HR recruitment process with this intelligent automation that reads candidate emails and resumes, analyzes them using GPT-4, and automatically shortlists or rejects applicants based on

Gmail, Gmail Trigger, HTTP Request +7