{
  "name": "Extract data from PDF reports with Gmail, OCR, Google Sheets and OpenAI GPT-4.1-mini",
  "nodes": [
    {
      "id": "faecb5ae-a628-4321-94de-58bcc42b7585",
      "name": "New PDF Email Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        448,
        32
      ]
    },
    {
      "id": "911f22dd-b863-4590-8451-2a7fe082add7",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        672,
        32
      ]
    },
    {
      "id": "120a3000-0191-4b19-acb3-85d5b991d366",
      "name": "Check PDF Attachment Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        912,
        32
      ]
    },
    {
      "id": "e577ad39-928f-4b3c-9cf1-505592b0430a",
      "name": "Extract Text from PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1120,
        -64
      ]
    },
    {
      "id": "55085b36-7896-4200-b502-64cd16f26d9a",
      "name": "Parse Key Fields with AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1344,
        -64
      ]
    },
    {
      "id": "7b74d7a3-f37f-428d-909a-54708bfc40cc",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1352,
        160
      ]
    },
    {
      "id": "fbe3a9c0-c972-4f22-99a3-98f88c9b9577",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1480,
        160
      ]
    },
    {
      "id": "8e952ef4-0d11-464f-8524-6d8ea60501a0",
      "name": "Normalize Extracted Data",
      "type": "n8n-nodes-base.set",
      "position": [
        1696,
        -64
      ]
    },
    {
      "id": "736dbec4-a7a3-49ac-96cc-4936b6e68930",
      "name": "Classify Document Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        1920,
        -96
      ]
    },
    {
      "id": "5854eb50-5cc4-48ac-8b1c-b8e753bc4a42",
      "name": "Store Invoice Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2208,
        -256
      ]
    },
    {
      "id": "10c41b28-3232-4461-b401-e651ba17222d",
      "name": "Summarize Report with AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2144,
        232
      ]
    },
    {
      "id": "24a137bc-60bc-4339-932e-134a71a6046b",
      "name": "OpenAI Chat Model for Summary",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2216,
        456
      ]
    },
    {
      "id": "ded393e5-0186-4512-86d6-a60bcbc43a8d",
      "name": "Notify Contract Team",
      "type": "n8n-nodes-base.slack",
      "position": [
        2208,
        -64
      ]
    },
    {
      "id": "751424f0-bee1-48ba-a4c2-f50ba0732877",
      "name": "Store All Extracted Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2496,
        -160
      ]
    },
    {
      "id": "0683c1c1-63ae-4444-86ab-54b2ddebb4f2",
      "name": "Send Summary Notification",
      "type": "n8n-nodes-base.slack",
      "position": [
        2720,
        -160
      ]
    },
    {
      "id": "ab625317-7f5f-4e24-b16c-fbb3a53bdbea",
      "name": "Error Handler and Logger",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        128
      ]
    },
    {
      "id": "d9218bc4-05bc-47cd-a952-7ba4a73b04e4",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -144
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "ae1b8a71-34a6-46aa-9868-c29c2c513bef",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        -144
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "58183e1b-2c70-4909-b4c0-5c5fdc3bb07a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1312,
        -144
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "4d7730df-fee2-4078-8891-c4605cf83b19",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        -144
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "25d928e4-e431-4293-b487-e561019db775",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        176
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "d2f46e08-157b-48e5-9164-7f550154694e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        -336
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    }
  ],
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Parse Key Fields with AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Store Invoice Data": {
      "main": [
        [
          {
            "node": "Store All Extracted Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Contract Team": {
      "main": [
        [
          {
            "node": "Store All Extracted Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text from PDF": {
      "main": [
        [
          {
            "node": "Parse Key Fields with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New PDF Email Trigger": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Document Type": {
      "main": [
        [
          {
            "node": "Store Invoice Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Summarize Report with AI",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify Contract Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Check PDF Attachment Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Extracted Data": {
      "main": [
        [
          {
            "node": "Classify Document Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Key Fields with AI": {
      "main": [
        [
          {
            "node": "Normalize Extracted Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store All Extracted Data": {
      "main": [
        [
          {
            "node": "Send Summary Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Parse Key Fields with AI",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Summarize Report with AI": {
      "main": [
        [
          {
            "node": "Store All Extracted Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check PDF Attachment Exists": {
      "main": [
        [
          {
            "node": "Extract Text from PDF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Handler and Logger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model for Summary": {
      "ai_languageModel": [
        [
          {
            "node": "Summarize Report with AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}