Qualify and score omnichannel leads with OpenAI, Gmail, and Google Sheets
Ready for 3.0What this workflow does
This AI workflow has 22 nodes and runs on Gmail events (plus 1 other trigger). Along the way it connects OpenAI Chat Model, Gmail and Google Sheets.
How it runs
Trigger: On Gmail events (plus 1 other trigger).
- Set Gmail Lead Data (Edit Fields (Set)): sets 11 fields: source, sender_name, sender_email…
- Set Webhook Lead Data (Code): runs custom JavaScript code
- Set Lead Configuration (Edit Fields (Set)): sets 17 fields: pf_business_name, pf_business_description, pf_services_offered…
- If: checks a condition and branches into true / false
- Read Existing Leads from Sheets (Google Sheets): uses Google Sheets
- Check for Duplicate Leads (Code): runs custom JavaScript code
- If: checks a condition and branches into true / false
- Restore Lead Data (Code): runs custom JavaScript code
- Analyze Lead with AI (Basic LLM Chain): sends a prompt to an LLM, with model: OpenAI GPT-5.6 Analyzer; output parser: Parse AI Analysis Output
- Calculate Lead Score (Code): runs custom JavaScript code
…plus 6 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (11)
- Switch
n8n-nodes-base.switch - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - Webhook
n8n-nodes-base.webhook - Gmail Trigger
n8n-nodes-base.gmailTrigger - If
n8n-nodes-base.if - Google Sheets
n8n-nodes-base.googleSheets - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - Gmail
n8n-nodes-base.gmail
From the author
Quick overview This workflow captures inbound leads from Gmail or a webhook, uses OpenAI to extract qualification signals, scores and classifies each lead, logs it to Google Sheets, and creates a personalized Gmail draft for HOT leads to review before…