Classify Gmail support emails with AI and store tickets in PostgreSQL
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
What this workflow does
This AI workflow has 16 nodes and runs on Gmail events. Along the way it connects Gmail, Ollama Model and Postgres.
How it runs
Trigger: On Gmail events.
- Get many messages (Gmail): get many
- Text Classifier: classifies text into categories with AI, with model: Ollama Model
- Code: runs custom JavaScript code
- Code: runs custom JavaScript code
- Code: runs custom JavaScript code
- Code: runs custom JavaScript code
- Code: runs custom JavaScript code
- Code: runs custom JavaScript code
- Select rows from a table (Postgres): select
- Insert rows in a table (Postgres): uses Postgres
…plus 3 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 (7)
- Gmail
n8n-nodes-base.gmail - Text Classifier
@n8n/n8n-nodes-langchain.textClassifier - Ollama Model
@n8n/n8n-nodes-langchain.lmOllama - Postgres
n8n-nodes-base.postgres - Code
n8n-nodes-base.code - No Operation, do nothing
n8n-nodes-base.noOp - Gmail Trigger
n8n-nodes-base.gmailTrigger
From the author
This workflow automatically converts incoming Gmail messages into structured support tickets using AI classification. It assigns categories, generates a unique ticket ID, stores data in PostgreSQL, assigns a support agent based on workload, and sends an…