{
  "name": "AI email analyzer: Process PDFs, images & save to Google Drive + Telegram",
  "nodes": [
    {
      "id": "0526c603-2c35-4f65-88ee-e143f7aa3ca4",
      "name": "Email Trigger (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -80,
        500
      ]
    },
    {
      "id": "9b0b83d1-7d7c-4858-aedc-4816e2f02276",
      "name": "DeepSeek R1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1320,
        980
      ]
    },
    {
      "id": "2e8ad64a-d767-441e-9e12-7a75f5ed4c1c",
      "name": "Email Summarization Chain",
      "type": "@n8n/n8n-nodes-langchain.chainSummarization",
      "position": [
        1360,
        800
      ]
    },
    {
      "id": "97f2b5f8-b2ba-4bd5-a951-c97e64e6f833",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        -280
      ],
      "parameters": {
        "width": 580,
        "height": 400,
        "content": "# AI Email Analyzer: Process PDFs, Images \n\nThis is a powerful tool for automating email analysis and summarization, saving time and ensuring that important information is easily accessible and action"
      }
    },
    {
      "id": "d2012cbc-0e79-4579-ac3d-e5e84ad56dc1",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        960,
        120
      ]
    },
    {
      "id": "8a9d55b8-9ba5-4a6f-ae13-9c529875a2a4",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2040,
        -320
      ]
    },
    {
      "id": "658696f5-08e0-4d51-89bc-2a1c31576700",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2540,
        -420
      ]
    },
    {
      "id": "d2ba57c3-9e0e-4a7d-957d-216763e357c3",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3660,
        220
      ]
    },
    {
      "id": "10e6d3c6-10f6-4fea-be37-b5ee50e0b529",
      "name": "OpenRouter Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        3920,
        400
      ]
    },
    {
      "id": "dcdcb7f2-669d-4e1b-a3f2-49a5b6c760b1",
      "name": "Contain attachments?",
      "type": "n8n-nodes-base.if",
      "position": [
        260,
        500
      ]
    },
    {
      "id": "6280db8e-42e4-4f88-bbe7-4e65eff3a34f",
      "name": "Get PDF and images attachments",
      "type": "n8n-nodes-base.code",
      "position": [
        600,
        300
      ]
    },
    {
      "id": "53a7333d-fb49-46d4-9e3b-d186a5e416ca",
      "name": "Extract from PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1460,
        -540
      ]
    },
    {
      "id": "9d5c3b14-a3b0-4d2b-88d5-5a2c21a6907f",
      "name": "PDF Analyzer",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1780,
        -540
      ]
    },
    {
      "id": "ba6f6d2f-9a13-4bb4-80fb-72f5c4124473",
      "name": "Save summary PDF",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2580,
        -800
      ]
    },
    {
      "id": "4c7ff16e-8649-4364-9aa6-c06670f4c36a",
      "name": "All summaries",
      "type": "n8n-nodes-base.merge",
      "position": [
        3080,
        220
      ]
    },
    {
      "id": "46af5694-6b28-45e7-8b1b-d77482b326e7",
      "name": "Map image summaries",
      "type": "n8n-nodes-base.set",
      "position": [
        2020,
        280
      ]
    },
    {
      "id": "dc5858b7-c30b-413b-a1d0-143a068f2c87",
      "name": "Upload attachments",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1440,
        480
      ]
    },
    {
      "id": "9537f678-163c-40de-93f3-9934f4ae2ad0",
      "name": "Email summary",
      "type": "n8n-nodes-base.set",
      "position": [
        2000,
        800
      ]
    },
    {
      "id": "ba0c45d9-7d5a-413e-9034-3e22a79ead77",
      "name": "Send final summary",
      "type": "n8n-nodes-base.telegram",
      "position": [
        4340,
        220
      ]
    },
    {
      "id": "7a97052b-37c5-4754-ac1a-0f1a20569df7",
      "name": "Create final summary",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        3940,
        220
      ]
    },
    {
      "id": "99b4c22c-a29b-4b72-bc4a-bed5c1320386",
      "name": "Save summary image",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2020,
        20
      ]
    },
    {
      "id": "2b32c086-c436-436e-93c3-da88e6f08247",
      "name": "Save summary text",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2020,
        1040
      ]
    },
    {
      "id": "135bf3c3-e45f-4363-857b-2345e0bc7964",
      "name": "Convert text",
      "type": "n8n-nodes-base.markdown",
      "position": [
        860,
        940
      ]
    },
    {
      "id": "0c2cf33a-d7bb-438d-a9c9-06a77f91b56e",
      "name": "Gemini 2.0 Flash",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1700,
        -320
      ]
    },
    {
      "id": "50d5fd05-db5f-451c-92ce-e0f42d8322f9",
      "name": "Parsing",
      "type": "n8n-nodes-base.code",
      "position": [
        3360,
        220
      ]
    },
    {
      "id": "801659a1-cc9d-4014-9403-d6d0952e856a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        520,
        220
      ],
      "parameters": {
        "width": 260,
        "height": 240,
        "content": "Get all attachments present in the email (in this WF only PDFs and images are considered)"
      }
    },
    {
      "id": "15dc13b9-b35c-43d3-8af9-a8793382a2b6",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1740,
        -600
      ],
      "parameters": {
        "width": 340,
        "height": 200,
        "content": "Analyze the content of PDF files and make a summary for each one"
      }
    },
    {
      "id": "6c68ce17-13f1-4aba-9f43-e4003e5cd723",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1380,
        120
      ],
      "parameters": {
        "width": null,
        "height": 200,
        "content": "Analyze the content of the image and describe it accurately"
      }
    },
    {
      "id": "ff746258-dc11-43aa-afe9-06c9dfb3708b",
      "name": "Analyze image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1440,
        180
      ]
    },
    {
      "id": "ce353f02-72ff-49bf-9297-5a2b3229fa49",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1340,
        740
      ],
      "parameters": {
        "width": 320,
        "height": 180,
        "content": "Analyze the content of the email and summarize it"
      }
    },
    {
      "id": "01ee4c00-5993-47ce-af04-320cd3319593",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3060,
        100
      ],
      "parameters": {
        "width": 720,
        "height": 80,
        "content": "All the summaries of the email components (text, PDF, images) are aggregated and a final summary is generated"
      }
    }
  ],
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Upload attachments",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract from PDF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload attachments",
            "type": "main",
            "index": 0
          },
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parsing": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Create final summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "All summaries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek R1": {
      "ai_languageModel": [
        [
          {
            "node": "Email Summarization Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Convert text": {
      "main": [
        [
          {
            "node": "Email Summarization Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PDF Analyzer": {
      "main": [
        [
          {
            "node": "Save summary PDF",
            "type": "main",
            "index": 0
          },
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "All summaries": {
      "main": [
        [
          {
            "node": "Parsing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "Save summary image",
            "type": "main",
            "index": 0
          },
          {
            "node": "Map image summaries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email summary": {
      "main": [
        [
          {
            "node": "All summaries",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Extract from PDF": {
      "main": [
        [
          {
            "node": "PDF Analyzer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini 2.0 Flash": {
      "ai_languageModel": [
        [
          {
            "node": "PDF Analyzer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Save summary PDF": {
      "main": [
        []
      ]
    },
    "Save summary text": {
      "main": [
        []
      ]
    },
    "Save summary image": {
      "main": [
        []
      ]
    },
    "Upload attachments": {
      "main": [
        []
      ]
    },
    "Map image summaries": {
      "main": [
        [
          {
            "node": "All summaries",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Contain attachments?": {
      "main": [
        [
          {
            "node": "Get PDF and images attachments",
            "type": "main",
            "index": 0
          },
          {
            "node": "Convert text",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create final summary": {
      "main": [
        [
          {
            "node": "Send final summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Trigger (IMAP)": {
      "main": [
        [
          {
            "node": "Contain attachments?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Create final summary",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "PDF Analyzer",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Email Summarization Chain": {
      "main": [
        [
          {
            "node": "Save summary text",
            "type": "main",
            "index": 0
          },
          {
            "node": "Email summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get PDF and images attachments": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}