This workflow corresponds to n8n.io template #5518 — we link there as the canonical source.
This workflow follows the Gmail → Gmail Trigger recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "OlJ23u8YjjeZ3DGu",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Gmail Organizer",
"tags": [],
"nodes": [
{
"id": "a81015eb-1a7b-4832-8506-f84835713f21",
"name": "New Email Received",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-1380,
100
],
"parameters": {
"simple": false,
"filters": {},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"typeVersion": 1
},
{
"id": "9ab80617-5aa2-4c1a-9d5a-aab0c4387a45",
"name": "Categorize Email by Content",
"type": "n8n-nodes-base.switch",
"position": [
-1080,
100
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Work Emails",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": false,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.from }}",
"rightValue": "@company.com"
},
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.from }}",
"rightValue": "work"
},
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.subject }}",
"rightValue": "meeting"
},
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.subject }}",
"rightValue": "project"
}
]
},
"renameOutput": true
},
{
"outputKey": "Shopping Orders",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": false,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.from }}",
"rightValue": "amazon"
},
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.from }}",
"rightValue": "shop"
},
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.subject }}",
"rightValue": "order"
},
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.subject }}",
"rightValue": "receipt"
}
]
},
"renameOutput": true
},
{
"outputKey": "Newsletters",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": false,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.subject }}",
"rightValue": "newsletter"
},
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.subject }}",
"rightValue": "unsubscribe"
},
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.from }}",
"rightValue": "noreply"
},
{
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.from }}",
"rightValue": "no-reply"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "ab60dc70-310e-4e7f-97d5-21a29d2c771d",
"name": "Apply Work Label",
"type": "n8n-nodes-base.gmail",
"position": [
-780,
-60
],
"parameters": {
"labelIds": [
"Work"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"typeVersion": 2.1
},
{
"id": "6d74ae5c-fd8b-4b6f-8cb8-7500dd88e091",
"name": "Apply Shopping Label",
"type": "n8n-nodes-base.gmail",
"position": [
-780,
100
],
"parameters": {
"labelIds": [
"Shopping"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"typeVersion": 2.1
},
{
"id": "f365dfaf-18b3-46e4-9d3a-bebefa47e422",
"name": "Apply Newsletter Label",
"type": "n8n-nodes-base.gmail",
"position": [
-780,
240
],
"parameters": {
"labelIds": [
"Newsletter"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"typeVersion": 2.1
},
{
"id": "1b9ca166-9430-427f-9179-0ca6fcca702c",
"name": "Mark Work Email as Important",
"type": "n8n-nodes-base.gmail",
"position": [
-480,
-60
],
"parameters": {
"operation": "markAsImportant"
},
"typeVersion": 2.1
},
{
"id": "814ee0b2-f75a-49aa-9fb4-87424b73d199",
"name": "Archive Newsletter Email",
"type": "n8n-nodes-base.gmail",
"position": [
-480,
240
],
"parameters": {
"labelIds": [
"ARCHIVE"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"typeVersion": 2.1
},
{
"id": "266c2c00-6ec6-42b6-bf45-24717edc1bb9",
"name": "Main Workflow Explanation",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2020,
-400
],
"parameters": {
"color": 4,
"width": 450,
"height": 1000,
"content": "# \ud83d\udce7 Gmail Smart Email Organizer\n\n## What This Workflow Does\nAutomatically organizes your Gmail inbox by categorizing incoming emails and applying appropriate labels and actions based on sender and subject content.\n\n## How It Works\n1. **Monitors Gmail**: Checks for new emails every minute\n2. **Smart Categorization**: Analyzes sender and subject to categorize emails\n3. **Auto-Labeling**: Applies appropriate labels (Work, Shopping, Newsletter)\n4. **Smart Actions**: Marks work emails as important, archives newsletters\n\n## Categories\n\u2022 **Work**: Company emails, meetings, projects\n\u2022 **Shopping**: Orders, receipts, e-commerce\n\u2022 **Newsletter**: Marketing emails, subscriptions\n\n## Setup Required\n1. Connect your Gmail account via OAuth2\n2. Create labels in Gmail: 'Work', 'Shopping', 'Newsletter'\n3. Activate the workflow\n4. Customize keywords as needed\n\n## Benefits\n\u2705 Saves time on manual email organization\n\u2705 Never miss important work emails\n\u2705 Keeps inbox clean and organized\n\u2705 Runs automatically 24/7\n\n**Perfect for professionals who receive 20+ emails daily and want automated organization without complex rules.**"
},
"typeVersion": 1
},
{
"id": "5f96a973-6add-441e-a509-b4e94e33342e",
"name": "Step 1 - Email Detection",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1400,
-380
],
"parameters": {
"color": 7,
"width": 300,
"height": 260,
"content": "## Step 1: Email Detection\n\n**Gmail Trigger** monitors your inbox and triggers the workflow when new emails arrive.\n\n**Polling**: Every minute\n**Setup**: Requires Gmail OAuth2 connection"
},
"typeVersion": 1
},
{
"id": "0ea0e02b-fdfd-434d-a731-7c665bff1701",
"name": "Step 2 - Smart Categorization",
"type": "n8n-nodes-base.stickyNote",
"position": [
-880,
-420
],
"parameters": {
"color": 7,
"width": 300,
"height": 280,
"content": "## Step 2: Smart Categorization\n\n**Switch Node** analyzes email content using multiple conditions:\n- Sender domain/email\n- Subject keywords\n- Common patterns\n\n**Routes to**: Work, Shopping, Newsletter, or Other"
},
"typeVersion": 1
},
{
"id": "277ab3e7-95a6-4df3-ac77-e5cf37df1c55",
"name": "Step 3 - Automated Actions",
"type": "n8n-nodes-base.stickyNote",
"position": [
-360,
-380
],
"parameters": {
"color": 7,
"width": 350,
"height": 260,
"content": "## Step 3: Automated Actions\n\n**Gmail Nodes** perform category-specific actions:\n\n\ud83d\udd39 **Work Emails**: Add 'Work' label + Mark as Important\n\ud83d\udd39 **Shopping**: Add 'Shopping' label\n\ud83d\udd39 **Newsletter**: Add 'Newsletter' label + Archive\n\n**Result**: Organized inbox with proper labels and priority marking"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "637565f8-6faf-45a0-a198-419d4f89973e",
"connections": {
"Apply Work Label": {
"main": [
[
{
"node": "Mark Work Email as Important",
"type": "main",
"index": 0
}
]
]
},
"New Email Received": {
"main": [
[
{
"node": "Categorize Email by Content",
"type": "main",
"index": 0
}
]
]
},
"Apply Newsletter Label": {
"main": [
[
{
"node": "Archive Newsletter Email",
"type": "main",
"index": 0
}
]
]
},
"Categorize Email by Content": {
"main": [
[
{
"node": "Apply Work Label",
"type": "main",
"index": 0
}
],
[
{
"node": "Apply Shopping Label",
"type": "main",
"index": 0
}
],
[
{
"node": "Apply Newsletter Label",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
How it works: The organizer continuously monitors your Gmail inbox. It analyzes sender and subject to categorize emails (Work, Purchases, Newsletter) and automatically applies labels. Based on the category, it performs specific actions, such as marking important emails or…
Source: https://n8n.io/workflows/5518/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
The goal is to reduce inbox noise and automatically organize repetitive types of emails so that imprtant messages remain visible while unsolicited or promotional emails are handled automatically. When
This template is built to be customized for your specific needs. This template has the core logic and n8n node specific references sorted to work with dynamic file names throughout the workflow. Store
This is an elite enterprise-grade solution for Talent Acquisition and HR Ops teams. It automates the high-volume task of resume screening by transforming unstructured PDF applications into structured
📘 Description
📩🤖 This workflow automatically processes emails received in Gmail, extracts their attachments, and organizes them into specific folders in Google Drive based on the sender's email address.