PDFからサマリー作業フローを作成

中級

これはDocument Extraction, AI Summarization分野の自動化ワークフローで、14個のノードを含みます。主にSet, Code, Gmail, GoogleDocs, GoogleDriveなどのノードを使用。 Google Drive、GPT-4、メール通知を使ってPDFからプロフェッショナルな文書下書きの生成

前提条件
  • Googleアカウント + Gmail API認証情報
  • Google Drive API認証情報
  • OpenAI API Key

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "64CHobveljzJ6yLy",
  "meta": {
    "instanceId": "6304e8877aa0fde3913b14034debe07006963fb497d63f280a91bbd75c6c24e1",
    "templateCredsSetupCompleted": true
  },
  "name": "Draft Summary Workflow From PDF",
  "tags": [
    {
      "id": "jn7ddn1yzNyOdoUL",
      "name": "Google Drive",
      "createdAt": "2025-06-28T19:24:08.794Z",
      "updatedAt": "2025-06-28T19:24:08.794Z"
    },
    {
      "id": "wZ14hcyo2pYAOVlF",
      "name": "OpenAI",
      "createdAt": "2025-06-28T18:46:13.462Z",
      "updatedAt": "2025-06-28T18:46:13.462Z"
    },
    {
      "id": "aSK69HfkFtgcLEqN",
      "name": "PDF",
      "createdAt": "2025-06-28T19:24:31.376Z",
      "updatedAt": "2025-06-28T19:24:31.376Z"
    },
    {
      "id": "FSPdk64o7xvj2PAR",
      "name": "Document Automation",
      "createdAt": "2025-06-28T19:24:42.665Z",
      "updatedAt": "2025-06-28T19:24:42.665Z"
    },
    {
      "id": "pD2RVg49fBlIR8pA",
      "name": "Gmail",
      "createdAt": "2025-06-28T19:24:47.979Z",
      "updatedAt": "2025-06-28T19:24:47.979Z"
    }
  ],
  "nodes": [
    {
      "id": "0828fc42-59fb-40e3-b8d2-c7c00ce873a5",
      "name": "Google ドライブ Trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        40,
        160
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1etyS5ZZLmzmocuemFs7v012CRkUoxm8s",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1etyS5ZZLmzmocuemFs7v012CRkUoxm8s",
          "cachedResultName": "AI_Folder"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "0Fpa71OWKyUgnl7d",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9e9ef858-3a08-4c0a-b230-792c77a32ade",
      "name": "ファイルから抽出",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        480,
        160
      ],
      "parameters": {
        "options": {},
        "operation": "pdf",
        "binaryPropertyName": "=data"
      },
      "typeVersion": 1
    },
    {
      "id": "c82d3fee-ab06-49a1-acc5-770f3462d804",
      "name": "情報抽出器",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        920,
        160
      ],
      "parameters": {
        "text": "=You are an intelligent information extractor.\n\nYour task is to analyze the following PDF content and extract all relevant information, such as:\n\n- Names of people, organizations, or entities involved  \n- Dates, times, and locations  \n- Document numbers, reference IDs, or case/file numbers  \n- Financial amounts (e.g., totals, balances, payments)  \n- Descriptions of events, actions taken, or decisions made  \n- Responsibilities, obligations, or instructions  \n- References to laws, policies, contracts, or agreements  \n- Any technical, legal, business, or procedural terms  \n- Outcomes, conclusions, or next steps (if applicable)\n\nPresent your output in **organized paragraphs or bullet points** grouped by category.  \nAvoid summarizing — your goal is to **accurately extract and present the original information** as clearly and completely as possible.\n\n---\n\nPDF Content:  \n{{ $json.combined_text }}\n",
        "options": {
          "systemPromptTemplate": "You are an expert extraction algorithm.\n\nOnly extract relevant information from the text.\n\nIf you do not know the value of an attribute asked to extract, you may omit the attribute's value."
        },
        "attributes": {
          "attributes": [
            {
              "name": "Date ",
              "type": "date",
              "description": "Extract the Date "
            },
            {
              "name": "Letter Head Name",
              "description": "Extract the Name"
            },
            {
              "name": "Address",
              "description": "Extract the address it was sent"
            },
            {
              "name": "Date of Loss ",
              "type": "date",
              "description": "Extract the Date of Loss"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "254616b5-5270-47b7-9abd-e8fc19ec0ea3",
      "name": "OpenAI チャットモデル",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        940,
        320
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4",
          "cachedResultName": "gpt-4"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "Yks1Eic3YR07Cpm6",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cd5312ee-6680-4c43-a35a-de0088363cc3",
      "name": "CREATE GOOGLE DOC",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1640,
        160
      ],
      "parameters": {
        "title": "=Draft Document",
        "folderId": "1etyS5ZZLmzmocuemFs7v012CRkUoxm8s"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "dSGiWWxQdhY5ywpg",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "caee797a-3c11-4f71-9afd-4ecc8163a68d",
      "name": "集計 Extract Text",
      "type": "n8n-nodes-base.code",
      "position": [
        700,
        160
      ],
      "parameters": {
        "jsCode": "let combinedText = '';\n\nfor (const item of items) {\n  const text = item.json.extracted_text || item.json.text || '';\n  if (typeof text === 'string' && text.trim()) {\n    combinedText += text.trim() + '\\n---\\n'; // Delimit between PDFs\n  }\n}\n\nif (combinedText === '') {\n  return [{\n    json: {\n      data: 'No substantial text could be extracted from the provided PDFs.'\n    }\n  }];\n}\n\nreturn [{\n  json: {\n    combined_text: combinedText\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "7d3b7269-b1d0-4c32-b094-fef84a8d9b90",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 1220,
        "height": 480,
        "content": "This step retrieves the PDF from the designated Google Drive folder and extracts key information from it using an OpenAI agent. The extraction process can be customized to target specific data within the PDF's binary content, ensuring the right information is included in the final draft. Currently, it captures all details that appear relevant for generating a complete draft."
      },
      "typeVersion": 1
    },
    {
      "id": "f78cfa9f-dddb-4154-a18c-2a07cfe49e56",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        0
      ],
      "parameters": {
        "color": 3,
        "width": 1640,
        "height": 480,
        "content": "This part of the workflow uses an OpenAI agent to generate a draft based on the extracted binary data from the PDF. It then creates a Google Document within the same Google Drive folder and updates it with the generated content. Finally, the workflow captures the document's URL and sends a summary email containing a link to the completed draft."
      },
      "typeVersion": 1
    },
    {
      "id": "f957fb25-a35d-43fd-8641-5d3ba1a1fb5a",
      "name": "メール Summary Agent",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2080,
        160
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are a professional assistant writing a concise email summary. Your task is to extract **3–5 key points** from the following extracted text. These points should be:\n- Clearly written and easy to scan\n- Highly relevant to claims, coverage, losses, or responsible parties\n- Based on facts from the text — do not guess\n\nStart the response with: **“Summary of Drafted Document:”**, then list each bullet point using dashes.\n\nAvoid repeating any of the text verbatim unless it's a proper name or ID number.\n\n---\nText to summarize:\n{{ $('Aggregate Extract Text').item.json.combined_text }}\n"
            }
          ]
        },
        "simplify": false
      },
      "credentials": {
        "openAiApi": {
          "id": "Yks1Eic3YR07Cpm6",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "8955dc77-672b-4fbc-943f-472f5120a03a",
      "name": "Drafting エージェント",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1280,
        160
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini-2025-04-14",
          "cachedResultName": "GPT-4.1-MINI-2025-04-14"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "You are a professional assistant that summarizes PDF documents into well-written, structured summaries. Use a formal tone, clear organization, and complete sentences. Include all relevant names, dates, references, and outcomes. Do not copy the text verbatim—rephrase and summarize it."
            },
            {
              "content": "={\n  \"values\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are a highly skilled assistant specializing in drafting professional documents. Your expertise spans legal, business, technical, and general formats. Your job is to summarize extracted information from PDFs into well-written, formal drafts suitable for professional use.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"Here is the extracted information:\\n\\n{{ $('Aggregate Extract Text').item.json.combined_text }}\\n\\nPlease write a clear, structured summary of the PDF using this information. Use complete sentences and logical flow. Do not copy the input text—rephrase and synthesize it.\"\n    }\n  ]\n}\n\n\n"
            }
          ]
        },
        "simplify": false
      },
      "credentials": {
        "openAiApi": {
          "id": "Yks1Eic3YR07Cpm6",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "457dae81-f2b1-4719-a573-efe5e755e7be",
      "name": "Download Google ドライブ",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        260,
        160
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "0Fpa71OWKyUgnl7d",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "940c2be4-ea9b-4851-aa87-3a8677133723",
      "name": "UPDATE Google ドキュメント",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1880,
        160
      ],
      "parameters": {
        "simple": false,
        "actionsUi": {
          "actionFields": [
            {
              "text": "={{ $('Drafting Agent').item.json.choices[0].message.content }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "={{ $node[\"CREATE GOOGLE DOC\"].json.id }}"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "dSGiWWxQdhY5ywpg",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "6dea5a05-adac-41e8-adbb-4eb352dcc20b",
      "name": "Edit メール Message",
      "type": "n8n-nodes-base.set",
      "position": [
        2440,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a221e0c5-4dcb-459a-8147-abbabbf34170",
              "name": "DraftURL",
              "type": "string",
              "value": "=https://docs.google.com/document/d/{{ $('CREATE GOOGLE DOC').first().json.id }}/edit"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0ff51fb9-f2f1-4684-aef0-93f96eb7f758",
      "name": "メール送信",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2680,
        160
      ],
      "webhookId": "87feb027-5ab7-4084-a184-f456f42c5596",
      "parameters": {
        "sendTo": "mgullo24@gmail.com",
        "message": "=Hello,\n\nYour PDF extraction and draft generation process has completed successfully.\n\n\n{{ $node[\"Email Summary Agent\"].json.choices[0].message.content }}\n\nYou can view and edit the full draft here:\n{{ $node[\"Edit Email Message\"].json.DraftURL }}\n\nIf you have any questions or need further processing, please reply to this email.\n\n—  \nThis is an automated message from the Draft Agent Bot.\n",
        "options": {},
        "subject": "=Draft Agent",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "B0oVer8pX52LHrvw",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0f0bd4cd-e871-4a16-868f-4a650be1c198",
  "connections": {
    "Drafting Agent": {
      "main": [
        [
          {
            "node": "cd5312ee-6680-4c43-a35a-de0088363cc3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cd5312ee-6680-4c43-a35a-de0088363cc3": {
      "main": [
        [
          {
            "node": "UPDATE Google Docs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Aggregate Extract Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Information Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Edit Email Message": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "UPDATE Google Docs": {
      "main": [
        [
          {
            "node": "Email Summary Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Summary Agent": {
      "main": [
        [
          {
            "node": "Edit Email Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Download Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Google Drive": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Information Extractor": {
      "main": [
        [
          {
            "node": "Drafting Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Extract Text": {
      "main": [
        [
          {
            "node": "Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

中級 - 文書抽出, AI要約

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数14
カテゴリー2
ノードタイプ11
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
Michael Gullo

Michael Gullo

@drdoom

I’m passionate about using n8n to create realistic workflows that help working class people simplify their daily tasks. My workflows aim to make life easier by eliminating mundane, repetitive responsibilities that take up valuable time. I love turning automation into a tool that lets people focus on what matters most to them.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34