AI 邮件分析器:处理 PDF、图片

高级

这是一个AI领域的自动化工作流,包含 31 个节点。主要使用 If、Set、Code、Merge、Switch 等节点,结合人工智能技术实现智能自动化。 处理PDF、图片并保存至Google云端硬盘和Telegram

前置要求
  • Telegram Bot Token
  • Google Drive API 凭证
  • Google Sheets API 凭证
  • OpenAI API Key

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "MCzA5RzvO83kNJi7",
  "meta": {
    "instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
    "templateCredsSetupCompleted": true
  },
  "name": "AI 邮件分析器:处理 PDF、图片",
  "tags": [],
  "nodes": [
    {
      "id": "0526c603-2c35-4f65-88ee-e143f7aa3ca4",
      "name": "电子邮件触发器 (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -80,
        500
      ],
      "parameters": {
        "options": {},
        "downloadAttachments": true
      },
      "credentials": {
        "imap": {
          "id": "k31W9oGddl9pMDy4",
          "name": "IMAP info@n3witalia.com"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "9b0b83d1-7d7c-4858-aedc-4816e2f02276",
      "name": "DeepSeek R1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1320,
        980
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "deepseek/deepseek-r1:free",
          "cachedResultName": "deepseek/deepseek-r1:free"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "XJTqRiKFJpFs5MuX",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2e8ad64a-d767-441e-9e12-7a75f5ed4c1c",
      "name": "邮件摘要链",
      "type": "@n8n/n8n-nodes-langchain.chainSummarization",
      "position": [
        1360,
        800
      ],
      "parameters": {
        "options": {
          "binaryDataKey": "={{ $json.data }}",
          "summarizationMethodAndPrompts": {
            "values": {
              "prompt": "=Write a concise summary of the following in max 100 words :\n\n\"{{ $json.data }}\"\n\nDo not enter the total number of words used.",
              "combineMapPrompt": "=## Email Summarization System Prompt\n\nYou are a specialized AI assistant focused exclusively on creating precise, concise summaries of emails. Your task is to analyze the complete email text provided as input and produce a clear, comprehensive summary that captures all essential information in a cohesive narrative format.\n\n### Your responsibilities:\n\n1. Extract and summarize the main topic and purpose of the email\n2. Identify key points, requests, deadlines, or action items mentioned\n3. Preserve critical details like dates, times, locations, and names\n4. Maintain the original tone and urgency level of the message\n5. Organize information in order of importance\n6. Remove unnecessary pleasantries, redundancies, and filler content\n\n### Summary format:\n\n- Begin with a one-sentence overview of the email's main purpose\n- Present all key information in a cohesive paragraph format (no bullet points)\n- Follow a logical flow from most to least important information\n- Include any critical deadlines, requests, or action items within the narrative\n- Keep the summary to 3-5 sentences total\n- Use clear, straightforward language with appropriate transitions between ideas\n- Preserve the original intent and meaning without introducing new information\n\n### What to exclude:\n\n- Greetings and sign-offs\n- Redundant information\n- Minor details that don't affect the main message\n- Your own opinions or interpretations\n- Information not explicitly stated in the email\n\nThe email text to summarize is:\n{{$json.data}}"
            }
          }
        },
        "operationMode": "nodeInputBinary"
      },
      "typeVersion": 2
    },
    {
      "id": "97f2b5f8-b2ba-4bd5-a951-c97e64e6f833",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        -280
      ],
      "parameters": {
        "color": 3,
        "width": 580,
        "height": 400,
        "content": "# AI 邮件分析器:处理 PDF、图片"
      },
      "typeVersion": 1
    },
    {
      "id": "d2012cbc-0e79-4579-ac3d-e5e84ad56dc1",
      "name": "切换",
      "type": "n8n-nodes-base.switch",
      "position": [
        960,
        120
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "pdf",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "31b7fb0b-3149-479e-852a-52c1ec8935ca",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $binary.data.fileExtension }}",
                    "rightValue": "pdf"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "image",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9fe6411d-cf35-4fdd-a9ad-8c96f0a5cf66",
                    "operator": {
                      "type": "string",
                      "operation": "regex"
                    },
                    "leftValue": "={{ $binary.data.fileExtension }}",
                    "rightValue": "=/^(jpg|png)$/i"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {},
        "looseTypeValidation": true
      },
      "typeVersion": 3.2
    },
    {
      "id": "8a9d55b8-9ba5-4a6f-ae13-9c529875a2a4",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2040,
        -320
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"content\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "658696f5-08e0-4d51-89bc-2a1c31576700",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2540,
        -420
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "=output"
      },
      "typeVersion": 1
    },
    {
      "id": "d2ba57c3-9e0e-4a7d-957d-216763e357c3",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3660,
        220
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "data.output"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "10e6d3c6-10f6-4fea-be37-b5ee50e0b529",
      "name": "OpenRouter 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        3920,
        400
      ],
      "parameters": {
        "model": "google/gemini-2.0-flash-exp:free",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "pb06rfB4xmxzVe3Q",
          "name": "OpenRouter"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dcdcb7f2-669d-4e1b-a3f2-49a5b6c760b1",
      "name": "包含附件?",
      "type": "n8n-nodes-base.if",
      "position": [
        260,
        500
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "5cf96104-c887-44fe-b528-30171943dd15",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $binary.isNotEmpty() }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6280db8e-42e4-4f88-bbe7-4e65eff3a34f",
      "name": "获取 PDF 和图片附件",
      "type": "n8n-nodes-base.code",
      "position": [
        600,
        300
      ],
      "parameters": {
        "jsCode": "let results = [];\n\nfor (const item of $input.all()) {\n  for (key of Object.keys(item.binary)) {\n        results.push({\n            json: {},\n            binary: {\n                data: item.binary[key],\n            }\n        });\n    }\n}\n\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "53a7333d-fb49-46d4-9e3b-d186a5e416ca",
      "name": "从 PDF 提取",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1460,
        -540
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1
    },
    {
      "id": "9d5c3b14-a3b0-4d2b-88d5-5a2c21a6907f",
      "name": "PDF 分析器",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1780,
        -540
      ],
      "parameters": {
        "text": "=## PDF Summarization System Prompt\n\nYou are a specialized AI assistant tasked with creating concise, accurate summaries of documents. Your goal is to extract and distill the most important information from the content provided as input and present it in a clear, precise plain text summary.\n\n### Your responsibilities:\n\n1. Identify the main topic and purpose of the document\n2. Extract key points, arguments, findings, or conclusions\n3. Preserve essential data points, statistics, dates, and figures\n4. Recognize and highlight critical information and takeaways\n5. Maintain the original document's logical structure in your summary\n6. Prioritize information based on its significance to the document's purpose\n\n### Summary format:\n\n- Provide your summary in plain text only (no formatting)\n- Begin with a concise overview of the document's main topic and purpose\n- Present important points in a logical, sequential narrative\n- Use clear, direct language that accurately represents the original content\n- Maintain appropriate context for all extracted information\n- Keep the summary concise while including all crucial information\n- Use proper transitions between topics to maintain readability\n\n### What to exclude:\n\n- Minor details that don't contribute to the main points\n- Repetitive information\n- Extensive examples unless they're critical to understanding\n- Citations, references, and bibliographic details unless specifically important\n- Decorative or non-essential images (describe important visualized data if relevant)\n- Your own interpretations or opinions not supported by the document\n\n{{ $json.text }}",
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.5
    },
    {
      "id": "ba6f6d2f-9a13-4bb4-80fb-72f5c4124473",
      "name": "保存 PDF 摘要",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2580,
        -800
      ],
      "parameters": {
        "columns": {
          "value": {
            "ID": "={{ $('Email Trigger (IMAP)').item.json.metadata[\"x-message-id\"] }}",
            "DATE": "={{ $now.format('dd/LL/yyyy') }}",
            "TYPE": "pdf",
            "EMAIL": "={{ $('Email Trigger (IMAP)').item.json.from }}",
            "SUBJECT": "={{ $('Email Trigger (IMAP)').item.json.subject }}",
            "SUMMARY": "={{ $json.output.content }}"
          },
          "schema": [
            {
              "id": "DATE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "DATE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "EMAIL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "EMAIL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "SUBJECT",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "SUBJECT",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "TYPE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "TYPE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "SUMMARY",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "SUMMARY",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rBa0RI6XFfMerylVCV0dlKhJT_f4UAd8S6jyYX4aRRo/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1rBa0RI6XFfMerylVCV0dlKhJT_f4UAd8S6jyYX4aRRo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rBa0RI6XFfMerylVCV0dlKhJT_f4UAd8S6jyYX4aRRo/edit?usp=drivesdk",
          "cachedResultName": "Analyze Email + Attachments"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JYR6a64Qecd6t8Hb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "4c7ff16e-8649-4364-9aa6-c06670f4c36a",
      "name": "所有摘要",
      "type": "n8n-nodes-base.merge",
      "position": [
        3080,
        220
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3
    },
    {
      "id": "46af5694-6b28-45e7-8b1b-d77482b326e7",
      "name": "映射图片摘要",
      "type": "n8n-nodes-base.set",
      "position": [
        2020,
        280
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "11592bed-7555-4e61-a692-d71b1a733fd4",
              "name": "content",
              "type": "string",
              "value": "={{ $json.content }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "dc5858b7-c30b-413b-a1d0-143a068f2c87",
      "name": "上传附件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1440,
        480
      ],
      "parameters": {
        "name": "={{$now.format('yyyyLLddhhiiss')}}-{{ $binary.data.fileName }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1CV5PgqBQIVFEacmbApdCApjNEtoNPzXQ",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1CV5PgqBQIVFEacmbApdCApjNEtoNPzXQ",
          "cachedResultName": "Analyze attachments"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "HEy5EuZkgPZVEa9w",
          "name": "Google Drive account (n3w.it)"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "9537f678-163c-40de-93f3-9934f4ae2ad0",
      "name": "邮件摘要",
      "type": "n8n-nodes-base.set",
      "position": [
        2000,
        800
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ef348518-a9fb-4ea9-bd70-9dcf3bff092a",
              "name": "content",
              "type": "string",
              "value": "={{ $json.response.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ba0c45d9-7d5a-413e-9034-3e22a79ead77",
      "name": "发送最终摘要",
      "type": "n8n-nodes-base.telegram",
      "position": [
        4340,
        220
      ],
      "webhookId": "9c8e4675-762e-47dd-8cef-b94a5261ffd4",
      "parameters": {
        "text": "={{ $json.text }}",
        "chatId": "CHAT_ID",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "0hSq9VwaiJifiscT",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7a97052b-37c5-4754-ac1a-0f1a20569df7",
      "name": "创建最终摘要",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        3940,
        220
      ],
      "parameters": {
        "text": "=The inputs to synthesize are:\n'''\n{{ $json.output }}\n'''",
        "messages": {
          "messageValues": [
            {
              "message": "## Comprehensive Email Analysis System Prompt\n\nYou are a specialized AI assistant tasked with creating a unified, concise summary of an email and all its attachments. Your input includes a summary of the email text, summaries of any images, and summaries of any PDF attachments. Your goal is to synthesize all this information into a single coherent summary that captures the essential message and purpose.\n\n### Your responsibilities:\n\n1. Identify the overarching theme or purpose connecting the email and its attachments\n2. Recognize relationships between the email content and the attached materials\n3. Extract and consolidate the most critical information from all sources\n4. Maintain proper context when combining information from different sources\n5. Prioritize information based on relevance to the email's main purpose\n6. Create a unified narrative that flows logically between email content and attachments\n\n### Input structure:\n- Email summary: A summary of the main email text\n- Image descriptions: Summaries of any images attached to the email\n- PDF summaries: Condensed versions of any PDF documents attached\n\n### Output format:\n\n- Provide your summary in plain text only\n- Begin with a one-sentence statement of the email's overall purpose and theme\n- Present a unified narrative that integrates information from the email and all attachments\n- Organize information by importance and relevance, not by source\n- Keep the final summary concise (5-7 sentences maximum) while including all essential information\n- Use clear transitions to maintain coherence when moving between different information sources\n- Preserve the original intent and tone of the communication\n\n### What to include:\n\n- The main topic and purpose of the communication\n- Key points from both the email and attachments\n- Critical requests, deadlines, or action items\n- Essential details like dates, figures, or specific references\n- Contextual information that clarifies the purpose of attachments\n\n### What to exclude:\n\n- Redundant information repeated across multiple sources\n- Minor details that don't contribute to understanding the main message\n- Excessive descriptions of attachments beyond their relevance to the email's purpose\n- Your own interpretations beyond what's supported by the input materials"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.5
    },
    {
      "id": "99b4c22c-a29b-4b72-bc4a-bed5c1320386",
      "name": "保存图片摘要",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2020,
        20
      ],
      "parameters": {
        "columns": {
          "value": {
            "ID": "={{ $('Email Trigger (IMAP)').item.json.metadata[\"x-message-id\"] }}",
            "DATE": "={{ $now.format('dd/LL/yyyy') }}",
            "TYPE": "image",
            "EMAIL": "={{ $('Email Trigger (IMAP)').item.json.from }}",
            "SUBJECT": "={{ $('Email Trigger (IMAP)').item.json.subject }}",
            "SUMMARY": "={{ $json.content }}"
          },
          "schema": [
            {
              "id": "DATE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "DATE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "EMAIL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "EMAIL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "SUBJECT",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "SUBJECT",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "TYPE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "TYPE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "SUMMARY",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "SUMMARY",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rBa0RI6XFfMerylVCV0dlKhJT_f4UAd8S6jyYX4aRRo/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1rBa0RI6XFfMerylVCV0dlKhJT_f4UAd8S6jyYX4aRRo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rBa0RI6XFfMerylVCV0dlKhJT_f4UAd8S6jyYX4aRRo/edit?usp=drivesdk",
          "cachedResultName": "Analyze Email + Attachments"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JYR6a64Qecd6t8Hb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "2b32c086-c436-436e-93c3-da88e6f08247",
      "name": "保存文本摘要",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2020,
        1040
      ],
      "parameters": {
        "columns": {
          "value": {
            "ID": "={{ $('Email Trigger (IMAP)').item.json.metadata[\"x-message-id\"] }}",
            "DATE": "={{ $now.format('dd/LL/yyyy') }}",
            "TYPE": "email",
            "EMAIL": "={{ $('Email Trigger (IMAP)').item.json.from }}",
            "SUBJECT": "={{ $('Email Trigger (IMAP)').item.json.subject }}",
            "SUMMARY": "={{ $json.response.text }}"
          },
          "schema": [
            {
              "id": "DATE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "DATE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "EMAIL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "EMAIL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "SUBJECT",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "SUBJECT",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "TYPE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "TYPE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "SUMMARY",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "SUMMARY",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rBa0RI6XFfMerylVCV0dlKhJT_f4UAd8S6jyYX4aRRo/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1rBa0RI6XFfMerylVCV0dlKhJT_f4UAd8S6jyYX4aRRo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rBa0RI6XFfMerylVCV0dlKhJT_f4UAd8S6jyYX4aRRo/edit?usp=drivesdk",
          "cachedResultName": "Analyze Email + Attachments"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JYR6a64Qecd6t8Hb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "135bf3c3-e45f-4363-857b-2345e0bc7964",
      "name": "转换文本",
      "type": "n8n-nodes-base.markdown",
      "position": [
        860,
        940
      ],
      "parameters": {
        "html": "={{ $json.textHtml }}",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "0c2cf33a-d7bb-438d-a9c9-06a77f91b56e",
      "name": "Gemini 2.0 Flash",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1700,
        -320
      ],
      "parameters": {
        "model": "google/gemini-2.0-flash-exp:free",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "pb06rfB4xmxzVe3Q",
          "name": "OpenRouter"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "50d5fd05-db5f-451c-92ce-e0f42d8322f9",
      "name": "解析",
      "type": "n8n-nodes-base.code",
      "position": [
        3360,
        220
      ],
      "parameters": {
        "jsCode": "const inputData = $input.all();\n\nconst outputData = inputData.map(item => {\n  \n  const outputValue = item.json.output || item.json.content;\n\n  return {\n    data: {\n      output: outputValue \n    }\n  };\n});\n\nreturn outputData;"
      },
      "typeVersion": 2
    },
    {
      "id": "801659a1-cc9d-4014-9403-d6d0952e856a",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        520,
        220
      ],
      "parameters": {
        "width": 260,
        "height": 240,
        "content": "获取邮件中存在的所有附件(在此工作流中仅考虑 PDF 和图片)"
      },
      "typeVersion": 1
    },
    {
      "id": "15dc13b9-b35c-43d3-8af9-a8793382a2b6",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1740,
        -600
      ],
      "parameters": {
        "width": 340,
        "height": 200,
        "content": "分析 PDF 文件的内容并为每个文件制作摘要"
      },
      "typeVersion": 1
    },
    {
      "id": "6c68ce17-13f1-4aba-9f43-e4003e5cd723",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1380,
        120
      ],
      "parameters": {
        "height": 200,
        "content": "分析图片的内容并准确描述它"
      },
      "typeVersion": 1
    },
    {
      "id": "ff746258-dc11-43aa-afe9-06c9dfb3708b",
      "name": "分析图像",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1440,
        180
      ],
      "parameters": {
        "text": "## Image Analysis System Prompt\n\nYou are a specialized AI assistant focused on analyzing images. Your task is to carefully examine the image provided as input and produce a detailed, accurate description in plain text format.\n\n### Your responsibilities:\n\n1. Observe and describe the main subject(s) or focal point(s) of the image\n2. Identify notable objects, people, animals, or other elements present\n3. Describe the setting, background, and environment if applicable\n4. Note any text visible in the image, transcribing it accurately\n5. Recognize any actions, activities, or events taking place\n6. Identify relevant contextual information (time of day, weather, season, etc.)\n7. Describe colors, lighting, composition, and other visual elements when relevant\n\n### Response format:\n\n- Provide your analysis in plain text only (no HTML, markdown, or other formatting)\n- Begin with a concise overview of what the image depicts\n- Follow with a detailed description covering all significant elements\n- Organize information logically, typically moving from main subjects to background details\n- Use clear, descriptive language that accurately represents what is actually visible\n- Keep descriptions objective and factual\n\n### What to exclude:\n\n- Speculation about elements not clearly visible in the image\n- Subjective judgments or interpretations beyond what is objectively present\n- Personal opinions about the quality or purpose of the image\n- Complex technical analysis unless specifically relevant\n- Any formatting beyond plain text\n\nThe image to analyze is the one provided in the input.",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "resource": "image",
        "inputType": "base64",
        "operation": "analyze"
      },
      "credentials": {
        "openAiApi": {
          "id": "CDX6QM4gLYanh0P4",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "ce353f02-72ff-49bf-9297-5a2b3229fa49",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1340,
        740
      ],
      "parameters": {
        "width": 320,
        "height": 180,
        "content": "分析邮件的内容并总结它"
      },
      "typeVersion": 1
    },
    {
      "id": "01ee4c00-5993-47ce-af04-320cd3319593",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3060,
        100
      ],
      "parameters": {
        "width": 720,
        "height": 80,
        "content": "邮件所有组件(文本、PDF、图片)的摘要被汇总,并生成最终摘要"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "30310971-f23c-4761-823c-36ddad8bc8dd",
  "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
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

这是一个高级难度的工作流,适用于AI等场景。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量31
分类1
节点类型20
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at info@n3w.it or add me on Linkedin.com/in/davideboizza

外部链接
在 n8n.io 上查看 →

分享此工作流