{
  "name": "Inbox Butler (Demoyard EP03)",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": true,
        "filters": {
          "readStatus": "unread"
        },
        "options": {}
      },
      "id": "b7538251-b4d5-47c1-8997-64890b1d9f2e",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        300
      ]
    },
    {
      "parameters": {
        "inputText": "=From: {{ $('Gmail Trigger').item.json.From }}\nSubject: {{ $('Gmail Trigger').item.json.Subject }}\nPreview: {{ $('Gmail Trigger').item.json.snippet }}",
        "categories": {
          "categories": [
            {
              "category": "Urgent",
              "description": "Something is broken, a deadline is today, or someone needs an answer within hours."
            },
            {
              "category": "Clients",
              "description": "Questions, requests or replies from customers or business contacts that aren't urgent."
            },
            {
              "category": "Receipts",
              "description": "Order confirmations, invoices, payment receipts, shipping updates."
            },
            {
              "category": "Newsletters",
              "description": "Newsletters and content subscriptions I signed up for."
            },
            {
              "category": "Promotions",
              "description": "Sales, discounts, marketing and cold outreach."
            }
          ]
        },
        "options": {
          "fallback": "other"
        }
      },
      "id": "be87b1cb-5aef-4308-a2b6-8f5c82de03ca",
      "name": "Sort Email",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "typeVersion": 1.1,
      "position": [
        260,
        300
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini"
        },
        "options": {}
      },
      "id": "28ce2961-446b-4010-a4cd-2331d52adb9f",
      "name": "Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        260,
        560
      ],
      "notes": "Add your OpenAI credential. Or delete this node and attach an Anthropic or Gemini chat model instead.",
      "notesInFlow": true
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "labelIds": []
      },
      "id": "6782df4d-d8e0-462c-917f-06adff444d8d",
      "name": "Label: AI/Urgent",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        620,
        40
      ],
      "notes": "Pick the AI/Urgent label from the dropdown",
      "notesInFlow": true
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are my email assistant. Write a short, polite reply to the email below that acknowledges the issue, says I'm looking into it, and gives a realistic time I'll follow up (within 2 hours). Keep it under 80 words. Sign it \"— [Your name]\".\nThen use the Gmail tool to save it as a DRAFT reply. Never send email.\n\nFrom: {{ $('Gmail Trigger').item.json.From }}\nSubject: {{ $('Gmail Trigger').item.json.Subject }}\nEmail: {{ $('Gmail Trigger').item.json.snippet }}",
        "options": {}
      },
      "id": "fa53036e-0308-4644-a0a7-187cad4ea3a4",
      "name": "Draft Urgent Reply",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        900,
        40
      ]
    },
    {
      "parameters": {
        "resource": "draft",
        "operation": "create",
        "subject": "=Re: {{ $('Gmail Trigger').item.json.Subject }}",
        "emailType": "text",
        "message": "={{ $fromAI('reply_body', 'The full text of the reply email', 'string') }}",
        "options": {
          "threadId": "={{ $('Gmail Trigger').item.json.threadId }}",
          "sendTo": "={{ $('Gmail Trigger').item.json.From }}"
        }
      },
      "id": "fc1a8ee5-1399-4d33-9373-fb982aa7f7db",
      "name": "Create Gmail Draft",
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.2,
      "position": [
        1060,
        260
      ],
      "notes": "Drafts only. This workflow never sends email.",
      "notesInFlow": true
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "labelIds": []
      },
      "id": "492fd789-08d6-49f0-b9a3-e9eeb8200f9b",
      "name": "Label: AI/Clients",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        620,
        180
      ],
      "notes": "Pick the AI/Clients label from the dropdown",
      "notesInFlow": true
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "labelIds": []
      },
      "id": "1518802f-1db9-4aa8-a754-148fb0ae0000",
      "name": "Label: AI/Receipts",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        620,
        320
      ],
      "notes": "Pick the AI/Receipts label from the dropdown",
      "notesInFlow": true
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "labelIds": []
      },
      "id": "d199aab4-fa09-440f-a969-c8ca1830f18a",
      "name": "Label: AI/Newsletters",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        620,
        460
      ],
      "notes": "Pick the AI/Newsletters label from the dropdown",
      "notesInFlow": true
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "labelIds": []
      },
      "id": "ca0c3afd-84fa-4a9f-ad9d-1a9a31638db3",
      "name": "Label: AI/Promotions",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        620,
        600
      ],
      "notes": "Pick the AI/Promotions label from the dropdown",
      "notesInFlow": true
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "labelIds": []
      },
      "id": "e887d02c-cf3f-48cc-a997-5c062f988abd",
      "name": "Label: AI/Other",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        620,
        740
      ],
      "notes": "Optional: pick an AI/Other label, or delete this node",
      "notesInFlow": true
    }
  ],
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Sort Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Sort Email",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Draft Urgent Reply",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Sort Email": {
      "main": [
        [
          {
            "node": "Label: AI/Urgent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label: AI/Clients",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label: AI/Receipts",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label: AI/Newsletters",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label: AI/Promotions",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Label: AI/Other",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Label: AI/Urgent": {
      "main": [
        [
          {
            "node": "Draft Urgent Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Gmail Draft": {
      "ai_tool": [
        [
          {
            "node": "Draft Urgent Reply",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "active": false
}