{
  "meta": {
    "instanceId": "d97a35efa9230ba825e389dcf8247ce5a77a88f4113df9825ba41d6ce9398085"
  },
  "nodes": [
    {
      "id": "cd71d5f3-b50b-426d-840d-da6eea33a217",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        448
      ],
      "parameters": {
        "color": 2,
        "width": 336,
        "height": 956,
        "content": "# ⚙️ INITIAL SETUP GUIDE\n\n## STEP 1: Create Gmail Labels\nGo to Gmail and create these 4 labels:\n- `Urgent + Important`\n- `Not Urgent + Important`\n- `Urgent + Not Important`\n- `Not Urgent + Not Important`\n\n## STEP 2: Get Your Label IDs\n1. Create temporary Gmail node\n2. Set operation to **Get All Labels**\n3. Execute to see your label IDs\n4. Copy each label ID\n5. Replace IDs in Gmail nodes\n\n## STEP 3: Add Credentials\n**Gmail OAuth2:**\n- Click any Gmail node\n- Create new credential\n- Follow OAuth2 flow\n\n**OpenAI API:**\n- Get key from platform.openai.com\n- Add to OpenAI node\n\n## STEP 4: Test First\n- Use Manual Trigger\n- Process 5-10 emails\n- Verify accuracy\n- Then activate"
      },
      "typeVersion": 1
    },
    {
      "id": "5a5a84e6-bf32-4ef0-bc87-160d5fb5a610",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        816,
        608
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "6da49556-8b27-49bc-ac4a-7bd31dd371c7",
      "name": "AI Email Classifier",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        1088,
        736
      ],
      "parameters": {
        "options": {
          "systemPromptTemplate": "You are an expert email prioritization assistant. Classify the email based on the Eisenhower Matrix principles. Consider sender importance, content urgency, business impact, and deadline implications. Output only the category in JSON format without explanation."
        },
        "inputText": "={{ $json.text }}",
        "categories": {
          "categories": [
            {
              "category": "Urgent + Important",
              "description": "Emails requiring immediate action due to high impact. Not addressing them could have serious consequences. Includes legal matters, critical financial issues, investor communications, regulatory compliance, or user problems blocking service usage."
            },
            {
              "category": "Not Urgent + Important",
              "description": "Messages with high strategic value but no immediate deadline. Includes partnership opportunities, negotiations, relevant invitations, and key coordination that can be scheduled thoughtfully."
            },
            {
              "category": "Urgent + Not Important",
              "description": "Emails needing quick attention but not requiring your direct involvement. Operational or technical matters that can be delegated to another person or team without affecting strategic objectives."
            },
            {
              "category": "Not Urgent + Not Important",
              "description": "Emails with no immediate or strategic value. Includes promotions, spam, and generic messages that distract and can be ignored, deleted, or batch-reviewed later."
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "cc962116-3299-428f-9a88-06cfff08501b",
      "name": "OpenAI GPT-4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1160,
        1024
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "credential-id",
          "name": "openAiApi Credential"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "034c4031-95dc-4593-89f1-9cf0903591d7",
      "name": "Label: Not Urgent + Important",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1440,
        640
      ],
      "webhookId": "1004a7e9-b2fb-41f6-abbb-3d0f7989b12c",
      "parameters": {
        "labelIds": [
          "Label_108825101456559558"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "683a55c5-8738-4503-b721-42c5ba6fcbb2",
      "name": "Label: Urgent + Important",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1440,
        448
      ],
      "webhookId": "226c3439-cf11-406d-9369-cbdc5d56bd69",
      "parameters": {
        "labelIds": [
          "Label_4335697733647997523"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "17983317-e9ca-4d3f-bf7c-b8cf07955972",
      "name": "Label: Urgent + Not Important",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1440,
        832
      ],
      "webhookId": "7dcbf4d7-d400-4535-a867-a581fde2595c",
      "parameters": {
        "labelIds": [
          "Label_3686091807609025659"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "90f85ac6-a960-443c-9b26-9da29fde9a59",
      "name": "Label: Not Urgent + Not Important",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1440,
        1024
      ],
      "webhookId": "f04eabdf-4db0-4de9-ae25-b22f78b229fe",
      "parameters": {
        "labelIds": [
          "Label_4+12345678905"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "2ce3c21f-59ed-45bc-9606-72f74f792dc0",
      "name": "Archive Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1664,
        1024
      ],
      "webhookId": "ab56d3b1-f368-47f0-bbe1-7171ab7de394",
      "parameters": {
        "labelIds": [
          "INBOX",
          "CATEGORY_PERSONAL",
          "CATEGORY_FORUMS",
          "CATEGORY_PROMOTIONS",
          "CATEGORY_SOCIAL",
          "CATEGORY_UPDATES"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "removeLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0ba5af91-5501-4146-b43e-d9ac4c681a66",
      "name": "Manual Test Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        256,
        1488
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b57271f1-5747-4547-96f1-1a4cc13fddde",
      "name": "Batch Process Emails",
      "type": "n8n-nodes-base.gmail",
      "position": [
        448,
        1488
      ],
      "webhookId": "29d04f95-7070-4786-8f36-d2a5cca8706b",
      "parameters": {
        "limit": 5,
        "simple": false,
        "filters": {
          "labelIds": [
            "INBOX"
          ],
          "readStatus": "unread"
        },
        "options": {},
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "6737dc62-1849-4fdf-8ad7-03002c81312b",
      "name": "Filter Valid Emails",
      "type": "n8n-nodes-base.filter",
      "position": [
        640,
        1488
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "af426b69-affb-4fe6-a375-f5a711f553d3",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.text }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "fb3982b8-2085-43a0-a281-661b520eb3ca",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        592
      ],
      "parameters": {
        "width": 352,
        "height": 480,
        "content": "# 📥 AUTOMATIC EMAIL DETECTION\n\nGmail Trigger checks inbox every minute.\n\n## Current Settings:\n- **Polling**: Every 60 seconds\n- **Looks for**: New unread emails\n- **Processes**: One at a time\n\n## Optimization Tips:\n- **High volume**: Keep 1 minute\n- **Medium (20-50/day)**: 5 minutes\n- **Low (<20/day)**: 15 minutes\n\n💡 **Note**: Each execution uses API calls."
      },
      "typeVersion": 1
    },
    {
      "id": "d3e65c11-555b-435d-b4f3-2aa83c2cabc6",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -64
      ],
      "parameters": {
        "width": 880,
        "height": 592,
        "content": "# 📧 EISENHOWER MATRIX EMAIL AUTOMATION\n\nThis workflow automatically categorizes your Gmail emails using the Eisenhower Matrix productivity framework.\n\n## THE FOUR QUADRANTS:\n- **🔴 Urgent + Important (DO NOW)**: Crisis, deadlines, emergencies\n- **🟢 Not Urgent + Important (SCHEDULE)**: Planning, relationships, growth\n- **🟡 Urgent + Not Important (DELEGATE)**: Interruptions, some emails\n- **⚫ Not Urgent + Not Important (DELETE)**: Spam, time wasters\n\n## HOW IT WORKS:\n1. New emails trigger the workflow\n2. AI analyzes content and context\n3. Emails get labeled automatically\n4. Low-priority emails are archived\n\n## REQUIREMENTS:\n- Gmail account with OAuth2\n- OpenAI API key (GPT-4)\n- Four Gmail labels created"
      },
      "typeVersion": 1
    },
    {
      "id": "1e5e4e33-579f-4cd1-8aff-f1cf46db7269",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        1184
      ],
      "parameters": {
        "width": 416,
        "height": 944,
        "content": "# 🤖 AI CLASSIFICATION ENGINE\n\n## Analyzes:\n- Email content\n- Sender importance\n- Urgency keywords\n- Business impact\n- Deadlines\n\n## EXAMPLES:\n\n### 🔴 Urgent + Important:\n- Legal notice requiring response\n- Server down affecting customers\n- Investor meeting tomorrow\n- Compliance audit deadline\n\n### 🟢 Not Urgent + Important:\n- Q2 strategic planning\n- Partnership opportunity\n- Team development program\n- Annual review prep\n\n### 🟡 Urgent + Not Important:\n- Approve expense report\n- Meeting rescheduled\n- Update password reminder\n- Office supplies order\n\n### ⚫ Not Urgent + Not Important:\n- Newsletters\n- Promotions\n- Social notifications\n- Marketing emails"
      },
      "typeVersion": 1
    },
    {
      "id": "428158f8-3354-49a2-a558-dc95f529e330",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        208
      ],
      "parameters": {
        "width": 624,
        "height": 752,
        "content": "# 🏷️ GMAIL LABELING SYSTEM\n\n⚠️ **IMPORTANT: Replace Label IDs!**\nEach Gmail has unique IDs.\nYou MUST update them.\n\n## How Categories Are Handled:\n\n### 🔴 Urgent + Important:\n- Gets red label\n- Stays in inbox\n- Consider notifications\n\n### 🟢 Not Urgent + Important:\n- Gets green label\n- Stays in inbox\n- Review in planning time\n\n### 🟡 Urgent + Not Important:\n- Gets yellow label\n- Stays in inbox\n- Delegate or quick reply\n\n### ⚫ Not Urgent + Not Important:\n- Gets gray label\n- Auto-archived\n- Bulk review later\n\n**Pro Tip**: Create Gmail filters to show labels in sidebar."
      },
      "typeVersion": 1
    },
    {
      "id": "53971ed2-e8f7-45a5-a708-b07d663daf4f",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1648,
        1200
      ],
      "parameters": {
        "width": 560,
        "height": 496,
        "content": "# 🗄️ AUTO-ARCHIVE FEATURE\n\nOnly **Not Urgent + Not Important** emails get archived!\n\n## What Archiving Does:\n✅ Removes from inbox\n✅ Keeps classification label\n✅ Email remains searchable\n✅ Can access anytime\n\n## Labels Being Removed:\n- INBOX (archives it)\n- All category labels\n- Keeps custom label\n\n## Why This Matters:\n**Reduces inbox noise by 40-60%**\nLets you focus on what matters."
      },
      "typeVersion": 1
    },
    {
      "id": "9ccd31b9-f706-443e-8074-ab86ee691ebc",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        1664
      ],
      "parameters": {
        "width": 512,
        "height": 720,
        "content": "# 🧪 MANUAL BATCH PROCESSING\n\n## When to Use:\n- Initial setup testing\n- After vacation catch-up\n- Processing backlog\n- Testing accuracy\n\n## How It Works:\n1. Click **Execute Workflow**\n2. Fetches 100 unread emails\n3. Filters valid emails\n4. Processes through AI\n5. Applies labels at once\n\n## ⚠️ START SMALL!\n- **First test**: Set limit to 10\n- Check classifications\n- Adjust if needed\n- Then increase to 100\n\n## 💰 Cost Note:\n100 emails = $0.10-0.30\ndepending on length."
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI GPT-4": {
      "ai_languageModel": [
        [
          {
            "node": "AI Email Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "AI Email Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Email Classifier": {
      "main": [
        [
          {
            "node": "Label: Urgent + Important",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label: Not Urgent + Important",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label: Urgent + Not Important",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label: Not Urgent + Not Important",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Valid Emails": {
      "main": [
        [
          {
            "node": "AI Email Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Test Trigger": {
      "main": [
        [
          {
            "node": "Batch Process Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batch Process Emails": {
      "main": [
        [
          {
            "node": "Filter Valid Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Label: Not Urgent + Not Important": {
      "main": [
        [
          {
            "node": "Archive Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}