AutomationFlowsAI & RAG › Qualify B2B Leads with Groq AI, Apollo & Gmail

Qualify B2B Leads with Groq AI, Apollo & Gmail

Original n8n title: Qualify & Reach Out to B2b Leads with Groq Ai, Apollo, Gmail & Sheets

ByVKAPS IT @solutions on n8n.io

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Event trigger★★★★☆ complexityAI-powered12 nodesForm TriggerHTTP RequestAgentGmail ToolGroq ChatOutput Parser StructuredGoogle SheetsGoogle Sheets Trigger
AI & RAG Trigger: Event Nodes: 12 Complexity: ★★★★☆ AI nodes: yes Added:

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

This workflow follows the Agent → Form Trigger 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
{
  "id": "szS5RoHWF5QAzxqk",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "B2B AI Leads Automation",
  "tags": [],
  "nodes": [
    {
      "id": "d33856c0-ae76-494d-aa57-39ffe8de3852",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -540,
        -20
      ],
      "parameters": {
        "options": {},
        "formTitle": "Contact us",
        "formFields": {
          "values": [
            {
              "fieldLabel": "What's your Full Name?",
              "placeholder": "e.g. John Wich",
              "requiredField": true
            },
            {
              "fieldType": "email",
              "fieldLabel": "What is your email address?",
              "placeholder": "e.g. user@example.com",
              "requiredField": true
            },
            {
              "fieldType": "number",
              "fieldLabel": "What's your phone number?",
              "placeholder": "e.g. 1234567890",
              "requiredField": true
            },
            {
              "fieldLabel": "What's your Linkedin Profile URL"
            }
          ]
        },
        "formDescription": "get back to you"
      },
      "typeVersion": 2.2
    },
    {
      "id": "87e4f3a8-8f35-4320-9ddc-218bd8f1ccd0",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -320,
        -20
      ],
      "parameters": {
        "url": "https://api.apollo.io/api/v1/people/match",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "name",
              "value": "={{ $json['What\\'s your Full Name?'] }}"
            },
            {
              "name": "email",
              "value": "={{ $json['What is your email address?'] }}"
            },
            {
              "name": "reveal_phone_number",
              "value": "={{ $json['What\\'s your phone number?'] }}"
            },
            {
              "name": "linkedin_url",
              "value": "={{ $json['What\\'s your Linkedin Profile URL'] }}"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5aac3e51-fd45-4f7c-99e1-7b81b1a6ea8b",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        520,
        -40
      ],
      "parameters": {
        "text": "=You are a professional B2B sales assistant.\n\nCompose a short, professional, and polite outreach email to schedule a call with the following lead.\n\nTone: concise and respectful. The goal is to open a conversation and set up a meeting.\n\nUse this format:\n---\nSend a message in Gmail:\nTo: {{ $('HTTP Request').item.json.person.email }}\nSubject: Exploring Collaboration in AI Solutions\n\nHi {{ $('HTTP Request').item.json.person.name }},\n\nI hope this message finds you well.\n\nI\u2019m reaching out from ABC Pvt Ltd\u2014we specialize in tailored IT solutions, including AI and machine learning services. Given your role at {{ $('HTTP Request').item.json.person.employment_history[0].organization_name }}, I\u2019d love to briefly connect and explore potential synergies.\n\nWould you be available for a quick call sometime this week?\n\nBest regards,  \nABC XYZ  \nABC Pvt Ltd\n---\n\nHere is the lead detail:\nName: {{ $('HTTP Request').item.json.person.name }}\nEmail: {{ $('HTTP Request').item.json.person.email }}\nJob Title: {{ $('HTTP Request').item.json.person.title }}\nOrganization: {{ $('HTTP Request').item.json.person.employment_history[0].organization_name }}\n\nInstructions:\nTools - Send a message in Gmail Tools for send mails",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "02cd5fdd-1baa-4a03-8832-af83476eec98",
      "name": "Send a message in Gmail",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        600,
        200
      ],
      "parameters": {
        "sendTo": "={{ $('HTTP Request').item.json.person.email }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {},
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "cae69208-18b5-493b-8f14-809e0180a868",
      "name": "Groq Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        480,
        200
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fac878f8-18eb-482c-a889-5d694549af6c",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        720,
        200
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "da7ad0ef-87ae-4da0-bee0-d464c7e33d3c",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        920,
        -40
      ],
      "parameters": {
        "columns": {
          "value": {
            "Name": "={{ $('On form submission').item.json[\"What's your Full Name?\"] }}",
            "Email": "={{ $('On form submission').item.json[\"What is your email address?\"] }}",
            "Phone": "={{ $('On form submission').item.json[\"What's your phone number?\"] }}",
            "Job Title ": "={{ $('HTTP Request').item.json.person.title }}",
            "Linkedin URL": "={{ $('On form submission').item.json[\"What's your Linkedin Profile URL\"] }}",
            "Organization": "={{ $('HTTP Request').item.json.person.employment_history[0].organization_name }}"
          },
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Title ",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Job Title ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Organization",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Organization",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Linkedin URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Linkedin URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Potential",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Lead Potential",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z3BuYjWFsGjCjTmpyCUqtjL_gHPZDBriDzfMUudmArA/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Z3BuYjWFsGjCjTmpyCUqtjL_gHPZDBriDzfMUudmArA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z3BuYjWFsGjCjTmpyCUqtjL_gHPZDBriDzfMUudmArA/edit?usp=drivesdk",
          "cachedResultName": "N8N Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "b0c08c59-1116-44ed-914f-2e71e43d3208",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -100,
        -20
      ],
      "parameters": {
        "text": "=You are an expert lead qualifier.\n\nScore the lead from 1 to 10 based on these two criteria:\n\n\u2014 INDUSTRY MATCH (5 points max) \u2014\n- 5 points: Industry is AI, Artificial Intelligence, Machine Learning, Data Science\n- 3-4 points: Industry is closely related (e.g., analytics, automation, enterprise AI tools)\n- 0-2 points: Unrelated industry\n\n\u2014 JOB TITLE MATCH (5 points max) \u2014\n- 5 points: Decision-makers or influencers in AI (e.g., Head of AI, AI Director, CTO, AI Product Manager)\n- 3-4 points: Mid-level AI professionals (e.g., ML Engineer, Data Scientist)\n- 0-2 points: Not related to AI or junior roles\n\nReturn **only a single digit between 1 and 10** \u2014 no explanation, no labels, no extra text. and the data type must be a number\n\nLead details:\nName: {{ $json.person.name }}\nJob Title: {{ $json.person.title }}\nOrganization: {{ $json.person.employment_history[0].organization_name }}\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "e4e59a80-4c68-4880-accd-bd3be08cb759",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        260,
        -20
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "eb511082-5f34-4027-993b-a787340fc4ea",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{Number($json.output)}}",
              "rightValue": 6
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7aeac238-77c1-43ec-a189-2b69e72f745c",
      "name": "Groq Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        -20,
        200
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fa0db3cb-6bdf-46f4-9135-d2b149ca15a1",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -540,
        180
      ],
      "parameters": {
        "path": "17cfab42-90df-4af6-88ff-6ed925f861cc",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "e74c132d-0270-4585-ace8-0651fa4d9617",
      "name": "Google Sheets Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -560,
        -240
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f3d19998-54cd-44f4-9b27-35bdc6ed4a56",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Gmail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Source: https://n8n.io/workflows/5832/ — 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

This n8n workflow automates your entire B2B outreach pipeline from lead discovery to personalized cold email delivery. Submit a form, let Apollo find and enrich your leads, review AI-generated emails

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

🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.

OpenAI, HTTP Request, Form Trigger +7
AI & RAG

Digistars - Scrape & Crawl. Uses httpRequest, n8n-nodes-firecrawl-scraper, googleSheets, lmChatOpenAi. Event-driven trigger; 63 nodes.

HTTP Request, N8N Nodes Firecrawl Scraper, Google Sheets +5
AI & RAG

This automation is designed to help you generate AI-powered music tracks, cover art, and fully rendered music videos — all triggered from a simple Telegram chat and managed via Google Sheets.

OpenAI Chat, Memory Buffer Window, Output Parser Structured +11
AI & RAG

This workflow is designed for marketers, content creators, agencies, and solo founders who want to publish long‑form posts with visuals on autopilot using n8n and AI agents. ​

Tool Http Request, Agent, HTTP Request +27