Classify Gmail enquiries with GPT‑4o‑mini and log them to Google Sheets
Ready for 3.0What this workflow does
This workflow has 6 nodes and runs on Gmail events. Along the way it connects Gmail and Google Sheets. It also calls api.openai.com over HTTP.
How it runs
Trigger: On Gmail events.
- Settings (Edit Fields (Set)): sets 2 fields: model, excerpt_length
- Filter out machine-generated mail (Code): runs custom JavaScript code
- Classify with AI (HTTP Request): calls api.openai.com (POST)
- Validate the AI response (Code): runs custom JavaScript code
- Log to Google Sheets (Google Sheets): append
Services it uses
Other Google Sheets + Gmail templates (2,102) · Other OpenAI + Google Sheets templates (2,011) · Other OpenAI + Gmail templates (1,623)
HTTP calls to: api.openai.com
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) (Gmail Trigger).
Nodes used (5)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - HTTP Request
n8n-nodes-base.httpRequest - Google Sheets
n8n-nodes-base.googleSheets
From the author
Quick overview This workflow polls a Gmail inbox, filters out auto-replies and bounce emails, classifies real enquiries with an OpenAI-compatible chat model, validates and sanitizes the AI output, and appends each enquiry as a structured row in Google Sheets.…