AIメールアナライザー:PDF・画像処理

上級

これはAI分野の自動化ワークフローで、31個のノードを含みます。主にIf, Set, Code, Merge, Switchなどのノードを使用、AI技術を活用したスマート自動化を実現。 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 Email Analyzer: Process PDFs, Images",
  "tags": [],
  "nodes": [
    {
      "id": "0526c603-2c35-4f65-88ee-e143f7aa3ca4",
      "name": "Email Trigger (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": "Email Summarization Chain",
      "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": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        -280
      ],
      "parameters": {
        "color": 3,
        "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 actionable.\n\nAll summaries are saved on a Google Sheet and identified by a numeric ID referring to the single email.\n\n## Preliminary step:\n- Clone this [Google Drive Sheet](https://docs.google.com/spreadsheets/d/1rBa0RI6XFfMerylVCV0dlKhJT_f4UAd8S6jyYX4aRRo/edit?usp=sharing)\n- Insert  your Chat_ID in Telegram node\n- Choose the AI model you prefer\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d2012cbc-0e79-4579-ac3d-e5e84ad56dc1",
      "name": "Switch",
      "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": "Structured Output Parser",
      "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": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2540,
        -420
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "=output"
      },
      "typeVersion": 1
    },
    {
      "id": "d2ba57c3-9e0e-4a7d-957d-216763e357c3",
      "name": "Aggregate",
      "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 Chat Model1",
      "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": "Parsing",
      "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": "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)"
      },
      "typeVersion": 1
    },
    {
      "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"
      },
      "typeVersion": 1
    },
    {
      "id": "6c68ce17-13f1-4aba-9f43-e4003e5cd723",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1380,
        120
      ],
      "parameters": {
        "height": 200,
        "content": "Analyze the content of the image and describe it accurately"
      },
      "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": "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"
      },
      "typeVersion": 1
    },
    {
      "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"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "30310971-f23c-4761-823c-36ddad8bc8dd",
  "connections": {
    "d2012cbc-0e79-4579-ac3d-e5e84ad56dc1": {
      "main": [
        [
          {
            "node": "dc5858b7-c30b-413b-a1d0-143a068f2c87",
            "type": "main",
            "index": 0
          },
          {
            "node": "53a7333d-fb49-46d4-9e3b-d186a5e416ca",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "dc5858b7-c30b-413b-a1d0-143a068f2c87",
            "type": "main",
            "index": 0
          },
          {
            "node": "ff746258-dc11-43aa-afe9-06c9dfb3708b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "50d5fd05-db5f-451c-92ce-e0f42d8322f9": {
      "main": [
        [
          {
            "node": "d2ba57c3-9e0e-4a7d-957d-216763e357c3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d2ba57c3-9e0e-4a7d-957d-216763e357c3": {
      "main": [
        [
          {
            "node": "7a97052b-37c5-4754-ac1a-0f1a20569df7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "658696f5-08e0-4d51-89bc-2a1c31576700": {
      "main": [
        [
          {
            "node": "4c7ff16e-8649-4364-9aa6-c06670f4c36a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9b0b83d1-7d7c-4858-aedc-4816e2f02276": {
      "ai_languageModel": [
        [
          {
            "node": "2e8ad64a-d767-441e-9e12-7a75f5ed4c1c",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "135bf3c3-e45f-4363-857b-2345e0bc7964": {
      "main": [
        [
          {
            "node": "2e8ad64a-d767-441e-9e12-7a75f5ed4c1c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9d5c3b14-a3b0-4d2b-88d5-5a2c21a6907f": {
      "main": [
        [
          {
            "node": "ba6f6d2f-9a13-4bb4-80fb-72f5c4124473",
            "type": "main",
            "index": 0
          },
          {
            "node": "658696f5-08e0-4d51-89bc-2a1c31576700",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4c7ff16e-8649-4364-9aa6-c06670f4c36a": {
      "main": [
        [
          {
            "node": "50d5fd05-db5f-451c-92ce-e0f42d8322f9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ff746258-dc11-43aa-afe9-06c9dfb3708b": {
      "main": [
        [
          {
            "node": "99b4c22c-a29b-4b72-bc4a-bed5c1320386",
            "type": "main",
            "index": 0
          },
          {
            "node": "46af5694-6b28-45e7-8b1b-d77482b326e7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9537f678-163c-40de-93f3-9934f4ae2ad0": {
      "main": [
        [
          {
            "node": "4c7ff16e-8649-4364-9aa6-c06670f4c36a",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "53a7333d-fb49-46d4-9e3b-d186a5e416ca": {
      "main": [
        [
          {
            "node": "9d5c3b14-a3b0-4d2b-88d5-5a2c21a6907f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0c2cf33a-d7bb-438d-a9c9-06a77f91b56e": {
      "ai_languageModel": [
        [
          {
            "node": "9d5c3b14-a3b0-4d2b-88d5-5a2c21a6907f",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "ba6f6d2f-9a13-4bb4-80fb-72f5c4124473": {
      "main": [
        []
      ]
    },
    "2b32c086-c436-436e-93c3-da88e6f08247": {
      "main": [
        []
      ]
    },
    "99b4c22c-a29b-4b72-bc4a-bed5c1320386": {
      "main": [
        []
      ]
    },
    "dc5858b7-c30b-413b-a1d0-143a068f2c87": {
      "main": [
        []
      ]
    },
    "46af5694-6b28-45e7-8b1b-d77482b326e7": {
      "main": [
        [
          {
            "node": "4c7ff16e-8649-4364-9aa6-c06670f4c36a",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "dcdcb7f2-669d-4e1b-a3f2-49a5b6c760b1": {
      "main": [
        [
          {
            "node": "6280db8e-42e4-4f88-bbe7-4e65eff3a34f",
            "type": "main",
            "index": 0
          },
          {
            "node": "135bf3c3-e45f-4363-857b-2345e0bc7964",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "135bf3c3-e45f-4363-857b-2345e0bc7964",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7a97052b-37c5-4754-ac1a-0f1a20569df7": {
      "main": [
        [
          {
            "node": "ba0c45d9-7d5a-413e-9034-3e22a79ead77",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0526c603-2c35-4f65-88ee-e143f7aa3ca4": {
      "main": [
        [
          {
            "node": "dcdcb7f2-669d-4e1b-a3f2-49a5b6c760b1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "10e6d3c6-10f6-4fea-be37-b5ee50e0b529": {
      "ai_languageModel": [
        [
          {
            "node": "7a97052b-37c5-4754-ac1a-0f1a20569df7",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "8a9d55b8-9ba5-4a6f-ae13-9c529875a2a4": {
      "ai_outputParser": [
        [
          {
            "node": "9d5c3b14-a3b0-4d2b-88d5-5a2c21a6907f",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "2e8ad64a-d767-441e-9e12-7a75f5ed4c1c": {
      "main": [
        [
          {
            "node": "2b32c086-c436-436e-93c3-da88e6f08247",
            "type": "main",
            "index": 0
          },
          {
            "node": "9537f678-163c-40de-93f3-9934f4ae2ad0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6280db8e-42e4-4f88-bbe7-4e65eff3a34f": {
      "main": [
        [
          {
            "node": "d2012cbc-0e79-4579-ac3d-e5e84ad56dc1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級 - 人工知能

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(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で表示

このワークフローを共有

カテゴリー

カテゴリー: 34