{ "name": "Classify Incoming Gmail Messages with AI", "tags": [], "nodes": [ { "id": "classify-incoming-gmail-messages-with-ai-0", "name": "Gmail Trigger", "type": "n8n-nodes-base.gmailTrigger", "position": [ 0, 0 ], "parameters": { "simple": false, "filters": { "includeDrafts": false, "includeSpamTrash": false, "readStatus": "both" }, "options": {}, "pollTimes": { "item": [ { "mode": "everyMinute" } ] }, "maxResults": 50 }, "typeVersion": 1.4 }, { "id": "classify-incoming-gmail-messages-with-ai-1", "name": "Google Gemini Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini", "position": [ 220, 320 ], "parameters": { "options": {}, "modelName": "models/gemini-2.0-flash-001" }, "typeVersion": 1 }, { "id": "classify-incoming-gmail-messages-with-ai-2", "name": "Classification Agent", "type": "@n8n/n8n-nodes-langchain.textClassifier", "position": [ 240, 0 ], "parameters": { "options": { "systemPromptTemplate": "Please classify the text provided by the user into one of the following categories: {categories}, and use the provided formatting instructions below. Don't explain, and only output the json." }, "inputText": "={{ $json.text || $json.html }}", "categories": { "categories": [ { "category": "High Priority", "description": "Emails requiring immediate attention or action, typically from key stakeholders, clients, or decision-makers. These emails often contain time-sensitive requests, deadlines, or escalated issues. Keywords: urgent, ASAP, immediate, deadline, action required, high priority" }, { "category": "KS Work Related", "description": "Messages related to YOUR_ORGANIZATION or its work." }, { "category": "Promotion", "description": "Anything related to updating on promotions. Keywords: newsletter, promotion, offer, sale, campaign, marketing, launch" }, { "category": "Other", "description": "If you don't know what category is this email." } ] } }, "typeVersion": 1 }, { "id": "classify-incoming-gmail-messages-with-ai-3", "name": "Add Label Promotion", "type": "n8n-nodes-base.gmail", "position": [ 700, 200 ], "parameters": { "labelIds": [ "YOUR_PROMOTION_LABEL_ID" ], "messageId": "={{ $json.id }}", "operation": "addLabels" }, "typeVersion": 2.1 }, { "id": "classify-incoming-gmail-messages-with-ai-4", "name": "Add Label (KS Work Related)", "type": "n8n-nodes-base.gmail", "position": [ 700, 0 ], "parameters": { "labelIds": [ "YOUR_WORK_LABEL_ID" ], "messageId": "={{ $json.id }}", "operation": "addLabels" }, "typeVersion": 2.1 }, { "id": "classify-incoming-gmail-messages-with-ai-5", "name": "Add Label (High Priority)", "type": "n8n-nodes-base.gmail", "position": [ 700, -200 ], "parameters": { "labelIds": [ "YOUR_PRIORITY_LABEL_ID" ], "messageId": "={{ $json.id }}", "operation": "addLabels" }, "typeVersion": 2.1 } ], "active": false, "pinData": {}, "settings": { "executionOrder": "v1" }, "connections": { "Gmail Trigger": { "main": [ [ { "node": "Classification Agent", "type": "main", "index": 0 } ] ] }, "Classification Agent": { "main": [ [ { "node": "Add Label (High Priority)", "type": "main", "index": 0 } ], [ { "node": "Add Label (KS Work Related)", "type": "main", "index": 0 } ], [ { "node": "Add Label Promotion", "type": "main", "index": 0 } ] ] }, "Google Gemini Chat Model": { "ai_languageModel": [ [ { "node": "Classification Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Add Label (KS Work Related)": { "main": [ [] ] } } }