Zusammenfassungs-Workflow aus PDFs

Fortgeschritten

Dies ist ein Document Extraction, AI Summarization-Bereich Automatisierungsworkflow mit 14 Nodes. Hauptsächlich werden Set, Code, Gmail, GoogleDocs, GoogleDrive und andere Nodes verwendet. Professionelle Dokumententwürfe aus PDFs mit Google Drive, GPT-4 und E-Mail-Benachrichtigungen generieren

Voraussetzungen
  • Google-Konto + Gmail API-Anmeldedaten
  • Google Drive API-Anmeldedaten
  • OpenAI API Key
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in 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 Drive 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": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        480,
        160
      ],
      "parameters": {
        "options": {},
        "operation": "pdf",
        "binaryPropertyName": "=data"
      },
      "typeVersion": 1
    },
    {
      "id": "c82d3fee-ab06-49a1-acc5-770f3462d804",
      "name": "Informationsextraktor",
      "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-Chat-Modell",
      "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": "Aggregieren 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": "Haftnotiz",
      "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": "Haftnotiz1",
      "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": "E-Mail 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 Agent",
      "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 Drive",
      "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 Docs",
      "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 E-Mail 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": "E-Mail senden",
      "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": {
    "8955dc77-672b-4fbc-943f-472f5120a03a": {
      "main": [
        [
          {
            "node": "cd5312ee-6680-4c43-a35a-de0088363cc3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cd5312ee-6680-4c43-a35a-de0088363cc3": {
      "main": [
        [
          {
            "node": "940c2be4-ea9b-4851-aa87-3a8677133723",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9e9ef858-3a08-4c0a-b230-792c77a32ade": {
      "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
          }
        ]
      ]
    },
    "940c2be4-ea9b-4851-aa87-3a8677133723": {
      "main": [
        [
          {
            "node": "Email Summary Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Summary Agent": {
      "main": [
        [
          {
            "node": "Edit Email Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0828fc42-59fb-40e3-b8d2-c7c00ce873a5": {
      "main": [
        [
          {
            "node": "457dae81-f2b1-4719-a573-efe5e755e7be",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "457dae81-f2b1-4719-a573-efe5e755e7be": {
      "main": [
        [
          {
            "node": "9e9ef858-3a08-4c0a-b230-792c77a32ade",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Information Extractor": {
      "main": [
        [
          {
            "node": "8955dc77-672b-4fbc-943f-472f5120a03a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Extract Text": {
      "main": [
        [
          {
            "node": "Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Fortgeschritten - Dokumentenextraktion, KI-Zusammenfassung

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Fortgeschritten
Anzahl der Nodes14
Kategorie2
Node-Typen11
Schwierigkeitsbeschreibung

Für erfahrene Benutzer, mittelkomplexe Workflows mit 6-15 Nodes

Autor
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.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34