This repository contains workflows for lead qualification automation using n8n.
Click the thumbnail above to watch the full demo video on YouTube.
-
workflow.json
- End-to-end workflow for lead qualification:
- Trigger: Gmail new email
- Categorization: OpenAI (High/Medium/Low) via reusable subflow
- High Intent → Google Sheet (
High Intenttab) - Medium/Low → Gmail reply + Google Sheet (
Low/Medium Intenttab) - Discord notifications for all leads
- Retry logic enabled on all API nodes (OpenAI, Gmail, Google Sheets, Discord) with up to 3 retries and 1s wait between retries
- End-to-end workflow for lead qualification:
-
lead-categorization-subflow.json
- Reusable subflow that takes a lead message as input and returns:
{ "category": "High", "confidence": 0.92 } - Can be called from any workflow using a Subflow node
- Confidence score represents the AI's certainty (0 = low, 1 = high)
- Retry logic applied to OpenAI node
- Reusable subflow that takes a lead message as input and returns:
-
subflow-wrapper.json
- Minimal workflow to test the subflow independently
- Trigger: Webhook
- Calls the subflow and returns category + confidence
-
Connect your Google account in n8n to enable Gmail and Google Sheets operations.
-
Create a Google Sheet document to store lead data.
-
Create two tabs (sheets) inside the document:
High Intent→ for leads categorized as High IntentLow/Medium Intent→ for leads categorized as Medium or Low Intent
-
Replace placeholders in workflows with your credentials:
YOUR_OPENAI_API_KEY→ for OpenAI connectionYOUR_DISCORD_WEBHOOK_URL→ for sending notifications to Discord
-
Import workflows into n8n and test:
- Trigger via Gmail new email or via webhook
- Confirm leads are categorized correctly
- Verify Google Sheet updates, Gmail replies, and Discord notifications
- Retry logic ensures that temporary network/API failures don’t break the workflow.
- The subflow can be reused in multiple workflows or tested independently via webhook.
- The AI categorization returns a confidence score between 0 and 1 to indicate certainty.
