{
  "name": "Automatic invoice detection & reminder creation with Gmail & Google Tasks",
  "nodes": [
    {
      "id": "95eeaaed-ce70-4f9d-82aa-e67bec2a84d2",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        -288
      ]
    },
    {
      "id": "46df89b3-2ac9-4905-ac0a-d4bcf4dbcf9a",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        448,
        -288
      ]
    },
    {
      "id": "9f3cb030-5bbb-4203-b473-84e986ab1848",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        480,
        -64
      ]
    },
    {
      "id": "4fcf203d-d777-4aaf-b157-64f7ddea55c5",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        608,
        -64
      ]
    },
    {
      "id": "51db6f62-ddb6-4cb3-b33e-b1431cbe9ba2",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1072,
        -96
      ]
    },
    {
      "id": "a6abcee9-5187-4777-a843-1d7096ac674c",
      "name": "Create a task",
      "type": "n8n-nodes-base.googleTasks",
      "position": [
        1072,
        -480
      ]
    },
    {
      "id": "09aa7d30-3328-42ea-a4d5-66944b72d43a",
      "name": "Add Label to Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1072,
        -288
      ]
    },
    {
      "id": "7fca02d6-db42-430a-bf26-ef80f84eaee7",
      "name": "Mark Email as read",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1296,
        -288
      ]
    },
    {
      "id": "e360894f-77e8-49cb-b8ba-e2d271fd521e",
      "name": "Get Unread Emails",
      "type": "n8n-nodes-base.gmail",
      "position": [
        224,
        -288
      ]
    },
    {
      "id": "f5674f2a-6875-4b89-94f8-13fb2d2c05fd",
      "name": "Check If Email is Invoice",
      "type": "n8n-nodes-base.if",
      "position": [
        848,
        -288
      ]
    },
    {
      "id": "a38b2d77-9ead-436d-ab40-12fcced60f72",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        952,
        -608
      ],
      "parameters": {
        "width": 336,
        "height": 288,
        "content": "### 💡 Customize Task Format  \nYou can change the title in this node.  For example: `Pay invoice from {{sender}} by {{due_date}}`  \nInclude more invoice details in the notes field if needed."
      }
    },
    {
      "id": "2f9a2857-ebe6-4d0f-a583-af4b655e4844",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        0
      ],
      "parameters": {
        "width": 304,
        "height": 224,
        "content": "### ⚠️ Setup Required  \n- Connect your Gmail account using OAuth2  \n- Add your OpenAI API Key under **API Credentials**  \n- Connect your Google Tasks account  \n- Create this label in Gmail: **Invoice*"
      }
    },
    {
      "id": "6da66212-1ddb-4822-b660-70e0a94dc0b2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -416
      ],
      "parameters": {
        "width": 320,
        "height": 272,
        "content": "### 💡 Schedule Trigger  \nThis runs every hour.  \nYou can change the interval here depending on how often you want Gmail to be checked."
      }
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Check If Email is Invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Unread Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Unread Emails": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Add Label to Email": {
      "main": [
        [
          {
            "node": "Mark Email as read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Check If Email is Invoice": {
      "main": [
        [
          {
            "node": "Add Label to Email",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create a task",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}