AutomationFlowsCRM & Sales › Manage B2b Referral Leads with Gmail, Slack, Hubspot, and Google Sheets

Manage B2b Referral Leads with Gmail, Slack, Hubspot, and Google Sheets

ByAvkash Kakdiya @itechnotion on n8n.io

This workflow receives B2B referral submissions via a webhook, validates the payload, emails the referrer and referred lead via Gmail, alerts the sales team in Slack, deduplicates and creates records in HubSpot, waits 3 days to send a follow-up if needed, and logs outcomes to…

Webhook trigger★★★★☆ complexity25 nodesGmailSlackHubSpotGoogle Sheets
CRM & Sales Trigger: Webhook Nodes: 25 Complexity: ★★★★☆ Added:
Manage B2b Referral Leads with Gmail, Slack, Hubspot, and Google Sheets — n8n workflow card showing Gmail, Slack, HubSpot integration

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

This workflow follows the Gmail → Google Sheets 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": "ZIDvlyXRgFBMPp9E",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Automated B2B Referral Program Manager",
  "tags": [
    {
      "id": "4Of2LE0HSt4qmmUG",
      "name": "Ansh",
      "createdAt": "2026-04-20T10:32:01.726Z",
      "updatedAt": "2026-04-20T10:32:01.726Z"
    }
  ],
  "nodes": [
    {
      "id": "7d77a4f0-df38-41e3-bcbf-945d90824631",
      "name": "Sticky Note Main",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        48
      ],
      "parameters": {
        "width": 564,
        "height": 768,
        "content": "## Automated B2B Referral Program Manager\nThis workflow automates your entire B2B referral process from end to end. When a referral is submitted via a form or webhook, it validates the data, thanks the referrer, alerts your sales team on Slack, logs the new lead in HubSpot (contact + deal), and triggers a nurture email sequence \u2014 with an automatic follow-up if the lead doesn't respond within 3 days.\n\n### How it works\n\n\t\u2022\tA referral is submitted via a webhook connected to your form or website.\n\t\u2022\tThe data is validated \u2014 incomplete submissions are rejected with a clear error.\n\t\u2022\tReferral details are extracted and structured for downstream use.\n\t\u2022\tA thank-you email goes to the referrer instantly via Gmail.\n\t\u2022\tYour sales team gets a real-time Slack alert with full referral details.\n\t\u2022\tHubSpot is checked for duplicates before creating a new contact and deal.\n\t\u2022\tA warm intro nurture email is sent to the referred lead.\n\t\u2022\tThe workflow waits 3 days \u2014 if no reply, a follow-up email is sent automatically.\n\t\u2022\tAll referral data is logged to Google Sheets for reporting and tracking.\n\t\u2022\tErrors at any stage are caught and posted to a Slack error channel.\n\n### Setup Steps\n\n\t1.\tConnect your referral form or website to the Webhook trigger URL.\n\t2.\tConnect Gmail, HubSpot, Google Sheets, and Slack credentials.\n\t3.\tUpdate the Google Sheet ID in the Sheets node with your tracking sheet.\n\t4.\tUpdate the Slack channel names in the Slack nodes (#referrals and #errors).\n\t5.\tTurn on the workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "cfe88d40-cdcb-48c7-88d6-b305e473f58b",
      "name": "Sticky Note Step1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 932,
        "height": 768,
        "content": "## Step 1: Capture & Validate the Referral\nThis section receives the referral form submission and immediately checks that all required fields are present. If anything critical is missing \u2014 like the lead's email \u2014 the workflow stops and sends a clear error response so the submitter knows what to fix."
      },
      "typeVersion": 1
    },
    {
      "id": "3869dba8-72b9-4293-861e-6b4a11f126d1",
      "name": "Sticky Note Step2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1376,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 500,
        "height": 768,
        "content": "## Step 2: Notify Referrer & Alert Sales Team\nThis section immediately sends a thank-you email to the person who made the referral so they feel acknowledged. At the same time, a detailed Slack message is posted to the sales channel so your team can see the referral in real time and prioritise follow-up."
      },
      "typeVersion": 1
    },
    {
      "id": "93dd1c78-f8ea-4714-a8d7-739837f35416",
      "name": "Sticky Note Step3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1904,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 772,
        "height": 768,
        "content": "## Step 3: CRM \u2014 Deduplicate, Create Contact & Deal\nThis section searches HubSpot to check if the referred lead already exists as a contact. If they are new, a contact is created with referral source details and a new Deal is added to your pipeline. If they already exist, the workflow skips creation and routes directly to outreach \u2014 no duplicates, no data mess."
      },
      "typeVersion": 1
    },
    {
      "id": "325c722a-f593-4682-acbe-a2f93204fc67",
      "name": "Sticky Note Step4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2704,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 1108,
        "height": 768,
        "content": "## Step 4: Nurture the Lead \u2014 Email + Auto Follow-Up\nThis section sends a warm intro email to the referred lead, mentioning who referred them. The workflow then waits 3 days and checks Gmail to see if the lead replied. If there is no reply, a second follow-up email is sent automatically. If they did reply, no follow-up is sent to avoid over-contact."
      },
      "typeVersion": 1
    },
    {
      "id": "347e6deb-c2d3-4059-8246-2bbfa60fd7d4",
      "name": "Sticky Note Step5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3840,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 612,
        "height": 768,
        "content": "## Step 5: Log & Error Handling\nThis section logs the complete referral record \u2014 including referrer, lead, and CRM status \u2014 into a Google Sheet for your team's tracking and weekly reporting. A separate error catch node monitors the entire workflow; if anything fails at any point, a formatted error message is posted to your Slack #errors channel so nothing silently breaks."
      },
      "typeVersion": 1
    },
    {
      "id": "5e6eeb4b-c54f-4b1f-b862-30c463c6d719",
      "name": "Referral Form Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        480,
        464
      ],
      "parameters": {
        "path": "referral-submission",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "600b9ffe-4248-4641-a7d2-e7d8a090ea74",
      "name": "Validate Required Fields",
      "type": "n8n-nodes-base.code",
      "position": [
        704,
        464
      ],
      "parameters": {
        "jsCode": "// Validate that all required fields are present\nconst body = $input.first().json.body || $input.first().json;\n\nconst required = [\n  { key: 'referrer_name',  label: 'Your Name' },\n  { key: 'referrer_email', label: 'Your Email' },\n  { key: 'referred_name',  label: 'Lead Name' },\n  { key: 'referred_email', label: 'Lead Email' }\n];\n\nconst missing = required\n  .filter(f => !body[f.key] && !body[f.key.replace('referred_', 'lead_')])\n  .map(f => f.label);\n\nif (missing.length > 0) {\n  return [{ json: { valid: false, missing_fields: missing, body } }];\n}\n\nreturn [{ json: { valid: true, body } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "3b8ea031-c363-4ae6-a7d3-8855db02aec8",
      "name": "Is Valid Submission?",
      "type": "n8n-nodes-base.if",
      "position": [
        928,
        464
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.valid }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "229bdd04-d603-47d9-9933-01d560fd7231",
      "name": "Respond \u2014 Validation Error",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1152,
        656
      ],
      "parameters": {
        "options": {
          "responseCode": 400
        },
        "respondWith": "json",
        "responseBody": "={ \"success\": false, \"error\": \"Missing required fields: {{ $json.missing_fields.join(', ') }}\" }"
      },
      "typeVersion": 1
    },
    {
      "id": "278ad97e-7fb4-487b-adfd-c7984432d50f",
      "name": "Respond \u2014 Success",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1152,
        272
      ],
      "parameters": {
        "options": {
          "responseCode": 200
        },
        "respondWith": "json",
        "responseBody": "={ \"success\": true, \"message\": \"Thank you! Your referral has been received.\", \"referral_id\": \"REF-{{ Date.now() }}\" }"
      },
      "typeVersion": 1
    },
    {
      "id": "3eb16662-734d-493b-a45c-34e3360f432d",
      "name": "Extract Referral Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1152,
        464
      ],
      "parameters": {
        "jsCode": "// Extract and structure referral data\nconst body = $input.first().json.body;\n\nconst referral = {\n  referrer_name:    body.referrer_name    || body.your_name    || 'Unknown Referrer',\n  referrer_email:   body.referrer_email   || body.your_email   || '',\n  referrer_company: body.referrer_company || body.your_company || '',\n\n  lead_name:    body.referred_name    || body.lead_name    || 'Unknown Lead',\n  lead_email:   body.referred_email   || body.lead_email   || '',\n  lead_company: body.referred_company || body.lead_company || '',\n  lead_phone:   body.referred_phone   || body.lead_phone   || '',\n\n  referral_notes:  body.notes   || body.message || '',\n  referral_source: 'B2B Referral Program',\n  submission_date: new Date().toISOString(),\n  referral_id:     'REF-' + Date.now()\n};\n\nreturn [{ json: referral }];"
      },
      "typeVersion": 2
    },
    {
      "id": "aa155f1a-546e-4d45-82f3-6dd76f3bfa49",
      "name": "Thank You Email to Referrer",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1456,
        464
      ],
      "parameters": {
        "sendTo": "={{ $json.referrer_email }}",
        "message": "<p>Hi {{ $json.referrer_name }},</p><p>Thank you so much for referring <strong>{{ $json.lead_name }}</strong> from <strong>{{ $json.lead_company }}</strong> to us!</p><p>We truly value your trust and will reach out to them shortly. We will keep you posted as things progress.</p><p>Referral ID: <strong>{{ $json.referral_id }}</strong></p><p>Best regards,<br/>The Team</p>",
        "options": {},
        "subject": "Thank you for your referral, {{ $json.referrer_name }}! \ud83d\ude4c"
      },
      "typeVersion": 2
    },
    {
      "id": "16a22e57-62a0-41e5-913c-8eb733f0614d",
      "name": "Slack Alert \u2014 Sales Team",
      "type": "n8n-nodes-base.slack",
      "position": [
        1696,
        464
      ],
      "parameters": {
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2
    },
    {
      "id": "f69f8587-7616-4774-a03d-49cc30257d62",
      "name": "Check Lead in HubSpot",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1952,
        464
      ],
      "parameters": {
        "limit": 1,
        "operation": "search",
        "additionalFields": {}
      },
      "typeVersion": 2
    },
    {
      "id": "5b3d5417-ffd4-459e-8c1f-9d851127900a",
      "name": "Is New Lead?",
      "type": "n8n-nodes-base.if",
      "position": [
        2128,
        464
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.results ? $json.results.length : 0 }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "d42b21c7-9000-4b7c-bbad-58fc12d5998c",
      "name": "Create HubSpot Contact",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        2336,
        400
      ],
      "parameters": {
        "operation": "create"
      },
      "typeVersion": 2
    },
    {
      "id": "80bb3621-b787-4eab-a355-6552da920a14",
      "name": "Create HubSpot Deal",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        2528,
        400
      ],
      "parameters": {
        "resource": "deal",
        "additionalFields": {
          "dealName": "Referral \u2014 {{ $('Extract Referral Data').item.json.lead_company }} via {{ $('Extract Referral Data').item.json.referrer_name }}",
          "pipeline": "default"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "846c2104-f70f-4aaf-adcf-8d1b51daa2f2",
      "name": "Send Nurture Email to Lead",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2784,
        480
      ],
      "parameters": {
        "sendTo": "={{ $('Extract Referral Data').item.json.lead_email }}",
        "message": "<p>Hi {{ $('Extract Referral Data').item.json.lead_name }},</p><p>Your colleague <strong>{{ $('Extract Referral Data').item.json.referrer_name }}</strong> at {{ $('Extract Referral Data').item.json.referrer_company }} thought you'd benefit from what we do.</p><p>We help B2B companies automate their operations and scale without adding headcount. I'd love to show you how we have helped businesses like yours.</p><p>Would you be open to a quick 20-minute call this week? Just reply to this email and we can find a time.</p><p>Best regards,<br/>The Team</p>",
        "options": {},
        "subject": "={{ $('Extract Referral Data').item.json.referrer_name }} thought we should connect"
      },
      "typeVersion": 2
    },
    {
      "id": "6dc67e38-5fcf-488b-a581-d28b68ce9a16",
      "name": "Wait 3 Days",
      "type": "n8n-nodes-base.wait",
      "position": [
        2992,
        480
      ],
      "parameters": {
        "unit": "days",
        "amount": 3
      },
      "typeVersion": 1
    },
    {
      "id": "d56e648a-5bb2-45d1-8629-ed1752b09de1",
      "name": "Check for Lead Reply",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3200,
        480
      ],
      "parameters": {
        "limit": 1,
        "filters": {
          "q": "from:{{ $('Extract Referral Data').item.json.lead_email }}"
        },
        "operation": "getAll"
      },
      "typeVersion": 2
    },
    {
      "id": "e5adbdd0-c61a-4289-8000-46ae0c81fdb9",
      "name": "Did Lead Reply?",
      "type": "n8n-nodes-base.if",
      "position": [
        3408,
        480
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ Array.isArray($json) ? $json.length : 0 }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "06d8646a-e523-4a18-9707-64f0ddbe3e7f",
      "name": "Send Follow-Up Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3664,
        384
      ],
      "parameters": {
        "sendTo": "={{ $('Extract Referral Data').item.json.lead_email }}",
        "message": "<p>Hi {{ $('Extract Referral Data').item.json.lead_name }},</p><p>I just wanted to follow up on my email from a few days ago. <strong>{{ $('Extract Referral Data').item.json.referrer_name }}</strong> spoke highly of you and we think there could be a great fit here.</p><p>Even a 15-minute conversation could be worth your time \u2014 just hit reply and we will sort it out.</p><p>Best regards,<br/>The Team</p>",
        "options": {},
        "subject": "Just checking in \u2014 {{ $('Extract Referral Data').item.json.referrer_name }} intro"
      },
      "typeVersion": 2
    },
    {
      "id": "864d1a11-bd21-4dd4-8601-41680ec8c54b",
      "name": "Log Referral to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3952,
        496
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $('Extract Referral Data').item.json.submission_date }}",
            "Notes": "={{ $('Extract Referral Data').item.json.referral_notes }}",
            "Status": "Nurture Sent",
            "Lead Name": "={{ $('Extract Referral Data').item.json.lead_name }}",
            "Lead Email": "={{ $('Extract Referral Data').item.json.lead_email }}",
            "Lead Phone": "={{ $('Extract Referral Data').item.json.lead_phone }}",
            "Referral ID": "={{ $('Extract Referral Data').item.json.referral_id }}",
            "HubSpot Deal": "Yes",
            "Lead Company": "={{ $('Extract Referral Data').item.json.lead_company }}",
            "Referrer Name": "={{ $('Extract Referral Data').item.json.referrer_name }}",
            "Follow-Up Sent": "={{ $('Did Lead Reply?').item ? 'No Reply \u2014 Follow-Up Sent' : 'Replied \u2014 No Follow-Up Needed' }}",
            "Referrer Email": "={{ $('Extract Referral Data').item.json.referrer_email }}",
            "HubSpot Contact": "Yes",
            "Referrer Company": "={{ $('Extract Referral Data').item.json.referrer_company }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Referrals"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "REPLACE_WITH_YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "a1ee2ad4-25ef-4182-a816-3c39badd7c1a",
      "name": "Slack Alert \u2014 Error Channel",
      "type": "n8n-nodes-base.slack",
      "onError": "continueRegularOutput",
      "position": [
        4208,
        496
      ],
      "parameters": {
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ba02e51f-10cd-4211-9e75-4afa32bcee9a",
  "connections": {
    "Wait 3 Days": {
      "main": [
        [
          {
            "node": "Check for Lead Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is New Lead?": {
      "main": [
        [
          {
            "node": "Create HubSpot Contact",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Nurture Email to Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Did Lead Reply?": {
      "main": [
        [
          {
            "node": "Send Follow-Up Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Referral to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create HubSpot Deal": {
      "main": [
        [
          {
            "node": "Send Nurture Email to Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for Lead Reply": {
      "main": [
        [
          {
            "node": "Did Lead Reply?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Valid Submission?": {
      "main": [
        [
          {
            "node": "Respond \u2014 Success",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract Referral Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond \u2014 Validation Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Follow-Up Email": {
      "main": [
        [
          {
            "node": "Log Referral to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Lead in HubSpot": {
      "main": [
        [
          {
            "node": "Is New Lead?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Referral Data": {
      "main": [
        [
          {
            "node": "Thank You Email to Referrer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Referral Form Webhook": {
      "main": [
        [
          {
            "node": "Validate Required Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create HubSpot Contact": {
      "main": [
        [
          {
            "node": "Create HubSpot Deal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Required Fields": {
      "main": [
        [
          {
            "node": "Is Valid Submission?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Nurture Email to Lead": {
      "main": [
        [
          {
            "node": "Wait 3 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack Alert \u2014 Sales Team": {
      "main": [
        [
          {
            "node": "Check Lead in HubSpot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Thank You Email to Referrer": {
      "main": [
        [
          {
            "node": "Slack Alert \u2014 Sales Team",
            "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 receives B2B referral submissions via a webhook, validates the payload, emails the referrer and referred lead via Gmail, alerts the sales team in Slack, deduplicates and creates records in HubSpot, waits 3 days to send a follow-up if needed, and logs outcomes to…

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

More CRM & Sales workflows → · Browse all categories →

Related workflows

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

CRM & Sales

This workflow receives inbound leads via webhook, validates and normalizes the data, scores and routes the lead to a sales rep, checks for duplicates and upserts the contact in HubSpot, drafts an outr

HubSpot, Slack, Gmail +2
CRM & Sales

This is ideal for agencies, freelancers, SaaS founders, and small sales teams who want every lead recorded and followed up automatically within seconds. The workflow supports two storage options: HubS

HTTP Request, Google Sheets, Slack +1
CRM & Sales

This workflow receives inbound leads via webhook, uses Anthropic Claude (with website scraping and web search) to score and classify them, then updates HubSpot lifecycle stage, creates deals for hot l

HTTP Request, HubSpot, Slack +1
CRM & Sales

Real-Time Lead Processing - Captures and processes leads instantly from website forms with zero delay Intelligent Fit Scoring - Automatically scores leads 0-100 based on company size, seniority, and r

Clearbit, HubSpot, HTTP Request +3
CRM & Sales

This workflow runs hourly to find HubSpot contacts whose lead score drops below a threshold, deduplicates alerts using Google Sheets, notifies the owner via Slack, creates a HubSpot follow-up task, se

HubSpot, Google Sheets, Slack +1