Triage and reply to Gmail with OpenAI trust levels and human approval
Ready for 3.0What this workflow does
This AI workflow has 18 nodes and runs on Gmail events. Along the way it connects Gmail and OpenAI Chat Model.
How it runs
Trigger: On Gmail events.
- Config (Edit Fields (Set)): sets 6 fields: approval_email, auto_rules, draft_rules…
- Skip already handled (Data table): row not exists
- Hard rules (Code): runs custom JavaScript code
- Matched a hard rule? (If): checks a condition and branches into true / false
- Rule: human only (Edit Fields (Set)): sets 4 fields: level, source, reason…
- AI trust check (AI Agent): runs an AI agent, with model: OpenAI Chat Model; output parser: Structured Output Parser
- Trust level (Switch): routes items into 3 branches
- Use AI decision (Edit Fields (Set)): sets 4 fields: level, source, reason…
- AI failed: human only (Edit Fields (Set)): sets 4 fields: level, source, reason…
- Auto: mark as read (Gmail): mark as read
…plus 5 more steps. See the full node list below.
Services it uses
Other OpenAI + Gmail templates (1,623)
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 (10)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Edit Fields (Set)
n8n-nodes-base.set - Data table
n8n-nodes-base.dataTable - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - AI Agent
@n8n/n8n-nodes-langchain.agent - 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
From the author
Quick overview This workflow monitors a Gmail inbox, uses an OpenAI chat model to classify each new email into a trust level, and then either marks it as read, drafts a reply for your approval via Gmail, or sends you a notification to handle it yourself. How…