Classify Gmail support emails with AI and store tickets in PostgreSQL
Ready for 3.0What 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
Other Gmail + PostgreSQL templates (82) · Other Ollama + PostgreSQL templates (20) · Other Gmail + Ollama templates (18)
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.
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
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…