{
  "name": "Extract purchase orders from Gmail using Gemini AI and save to Google Sheets",
  "nodes": [
    {
      "id": "be880ad2-61bc-4047-9ddf-a83d77e02e96",
      "name": "Get many messages",
      "type": "n8n-nodes-base.gmail",
      "position": [
        256,
        528
      ]
    },
    {
      "id": "d992ac3e-171d-434b-a19c-457f43df78eb",
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "position": [
        32,
        528
      ]
    },
    {
      "id": "8bc15902-aaeb-4b13-b048-4ebab762a74d",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        704,
        528
      ]
    },
    {
      "id": "ee93d6a2-74c9-4ba5-8efe-3246b62e85b7",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1152,
        544
      ]
    },
    {
      "id": "c2cbc323-d54a-436b-b4a9-443a21bed1eb",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1152,
        768
      ]
    },
    {
      "id": "cdff877c-5b0d-4286-988b-45633a1fd058",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        416
      ],
      "parameters": {
        "width": 608,
        "height": 320,
        "content": "## Scan Email on every minute and read new emails.\n**Get new emails frequently and filer them which has purchase order**"
      }
    },
    {
      "id": "a3a9541a-a8d6-4f7c-b486-69d73c26346d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        368
      ],
      "parameters": {
        "width": 400,
        "height": 368,
        "content": "## Check the document has attachment\n**Check for email without attachment. To read purchase order from the email body**"
      }
    },
    {
      "id": "5c00dba7-eb59-4f61-b35e-69ef78f57360",
      "name": "Set final output keys",
      "type": "n8n-nodes-base.set",
      "position": [
        928,
        544
      ]
    },
    {
      "id": "deb1c439-121b-42ad-b86b-e209ec852c58",
      "name": "Filter emails",
      "type": "n8n-nodes-base.filter",
      "position": [
        480,
        528
      ]
    },
    {
      "id": "5c602373-6737-493e-b8a0-13d95ac6b4d5",
      "name": "Reformatted to upload in Google sheet",
      "type": "n8n-nodes-base.code",
      "position": [
        1504,
        544
      ]
    },
    {
      "id": "1e737893-a942-40d0-b67f-92608c272cf9",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1088,
        400
      ],
      "parameters": {
        "width": 352,
        "height": 512,
        "content": "## AI Agent to read and summarize the order."
      }
    },
    {
      "id": "ba711eee-2943-43c0-9b6f-b224fa663f58",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        432
      ],
      "parameters": {
        "width": 368,
        "height": 304,
        "content": "## Append purchase order to Google sheet\n"
      }
    },
    {
      "id": "23258818-270c-47d3-8ebe-479359fd1e87",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        -192
      ],
      "parameters": {
        "width": 480,
        "height": 544,
        "content": "## 📧 Email Reading & Purchase Order Creation (AI-powered)\n\n**✨ What it does**  \n- ⏱ Reads unread emails every minute  \n- 🎯 Filters emails based on **Subject**  \n- 🤖 Uses Gemini AI to summarize emails "
      }
    },
    {
      "id": "c4f34423-862e-4165-be7f-8d79f6adb88d",
      "name": "Get row(s) in sheet in Google Sheets",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        1296,
        768
      ]
    },
    {
      "id": "db30105a-0daf-4611-bebc-f86ad4db91bb",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1712,
        544
      ]
    }
  ],
  "connections": {
    "If": {
      "main": [
        [],
        [
          {
            "node": "Set final output keys",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cron": {
      "main": [
        [
          {
            "node": "Get many messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Reformatted to upload in Google sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter emails": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many messages": {
      "main": [
        [
          {
            "node": "Filter emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set final output keys": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Reformatted to upload in Google sheet": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}