Block 1 - AI Check Email
- Type / Role
- @n8n/n8n-nodes-langchain.agent - agent
- Config choices
- Version 1.8
An AI powered Gmail assistant built with n8n that automatically labels emails, learns from your decisions, and safely improves over time using human in the loop training. This workflow combines: Gm...
@n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.outputparserstructured, @n8n/n8n-nodes-langchain.lmchatopenai, n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.telegram, n8n-nodes-base.datatabletool, n8n-nodes-base.manualtrigger, n8n-nodes-base.splitinbatches
This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Michael Montaque.
Original n8n.io sourceAn AI-powered Gmail assistant built with n8n that automatically labels emails, learns from your decisions, and safely improves over time using human-in-the-loop training.
This workflow combines:
to create a trainable AI inbox workflow that behaves more like an executive assistant than a traditional spam filter.
✅ AI-powered Gmail classification ✅ Dynamic Gmail label discovery ✅ Human-in-the-loop review system ✅ Trainable via Telegram ✅ Historical learning from previous decisions ✅ Gmail-safe architecture (labels first, no auto-delete) ✅ Backfill support for older emails ✅ Configurable confidence thresholds
The system uses a simple but powerful workflow:
New Email ↓ AI analyzes email ↓ Apply labels if confident ↓ If uncertain → send for review ↓ User teaches AI through Telegram ↓ Future emails become easier to classify
The workflow dynamically loads all your labels but it filters for sub-labels under the parent label AI.
Create a parent Gmail label named:
AI
Then create sub-labels underneath it.
Becuase the system dynamically fetches your labels:
Every processed email receives the AI parent label so emails are not repeatedly reprocessed.
The workflow uses a configurable confidence threshold.
// Example
item
.json.confidenceThreshold = .9;
| Threshold | Result |
|---|---|
| 0.95 | Very conservative |
| 0.90 | Recommended |
| 0.80 | More automation |
| 0.70 | Aggressive automation |
If confidence is:
ABOVE threshold → labels are applied automatically BELOW threshold → email enters review queue
When the AI is uncertain the email is tagged and a rule is added to the data table for review. Once you trigger the training flow, Telegram asks the user how future emails should be handled.
For each email rule, the user can:
Before asking the user for help, the AI searches previous decisions from the same sender.
If previous reviewed decisions exist:
Pending/unreviewed decisions are treated as weak references only.
Create an n8n Data Table named:
Email Rules
Recommended columns:
| Column | Type |
|---|---|
| emailId | string |
| threadId | string |
| fromEmail | string |
| fromName | string |
| subject | string |
| snippet | string |
| confidence | number |
| labelsApplied | string |
| reason | string |
| userQuestion | string |
| ruleSuggestion | string |
| isPending | boolean |
| recommendedAction | string |
Ideas for future upgrades:
AI)This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.
Showing the first 24 of 40 workflow blocks. Download the JSON for the full node graph.
| Workflow | Classify Gmail emails with OpenAI and Telegram feedback |
|---|---|
| Complexity | advanced |
| Nodes | 40 |
| Categories | Ticket Management, AI Summarization |
| Author | Michael Montaque |
| Published | 19 May 2026 |
Use the JSON export at /data/workflows/15805/15805.json as the source template for this automation.
Open n8n, import the downloaded JSON, and review each node before activating the workflow.
Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.
Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.
Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.
Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.
Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.
An AI powered Gmail assistant built with n8n that automatically labels emails, learns from your decisions, and safely improves over time using human in the loop training. This workflow combines: Gm...
Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.
Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Ticket Management, AI Summarization use case.