Qualify Gmail leads and draft replies with OpenAI and HubSpot
Ready for 3.0What this workflow does
This AI workflow has 21 nodes and runs on Gmail events. Along the way it connects Gmail, OpenAI Chat Model and HubSpot.
How it runs
Trigger: On Gmail events.
- Your business details (Edit Fields (Set)): sets 11 fields: companyName, whatYouSell, businessFacts…
- Skip already processed emails (Remove Duplicates): removes duplicate items
- Clean up email (Code): runs custom JavaScript code
- Classify email (Basic LLM Chain): sends a prompt to an LLM, with model: AI model; output parser: Classification format
- Decide what to do (Code): runs custom JavaScript code
- Route by result (Switch): routes items into 3 branches
- Write reply (Basic LLM Chain): sends a prompt to an LLM, with model: AI model; output parser: Reply format
- Find contact (HubSpot): search (contact)
- Alert me: manual review (Gmail): send (message)
- Prepare draft (Code): runs custom JavaScript code
…plus 7 more steps. See the full node list below.
Services it uses
Other OpenAI + Gmail templates (1,623) · Other HubSpot + Gmail templates (102) · Other OpenAI + HubSpot templates (86)
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.
- Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (New email in Gmail).
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (11)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Edit Fields (Set)
n8n-nodes-base.set - Remove Duplicates
n8n-nodes-base.removeDuplicates - Code
n8n-nodes-base.code - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Switch
n8n-nodes-base.switch - Gmail
n8n-nodes-base.gmail - HubSpot
n8n-nodes-base.hubspot - If
n8n-nodes-base.if
From the author
Quick overview This workflow monitors a Gmail inbox, uses OpenAI to classify and summarize incoming emails, drafts sales replies in Gmail, and creates or updates HubSpot contacts and deals for qualified new leads while sending you notification emails for new…