Intelligenter-Dokumentenfluss

Experte

Dies ist ein Document Extraction, AI Summarization-Bereich Automatisierungsworkflow mit 16 Nodes. Hauptsächlich werden If, Code, Wait, Gmail, GoogleDrive und andere Nodes verwendet. Institutionsinformationen und Dokumentenzusammenfassungen mit Foxit und Diffbot extrahieren

Voraussetzungen
  • Google-Konto + Gmail API-Anmeldedaten
  • Google Drive API-Anmeldedaten
  • Möglicherweise sind Ziel-API-Anmeldedaten erforderlich
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": "jq3ISjs9Ah5SrJEl",
  "meta": {
    "instanceId": "8a623c3f1a4c9388f43b80af022dca52562aec4339b44f00a07491999dffc00f",
    "templateCredsSetupCompleted": true
  },
  "name": "Intelligent Document Flow",
  "tags": [],
  "nodes": [
    {
      "id": "e0e1f4a8-973f-44cc-9103-b2a92fa0cd0c",
      "name": "Bei neuer Datei in Google Drive-Ordner auslösen",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -480,
        -140
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "url",
          "value": "https://drive.google.com/drive/folders/1yHMr9A68V4QLtd6fIKuM7BE1U4mpN6cD"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "yzSXRqiRtvWSu0sZ",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1a016850-c310-43a6-9925-538086367d4f",
      "name": "Datei herunterladen",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -260,
        -140
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "yzSXRqiRtvWSu0sZ",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "8a1bf842-514e-4f28-b799-989de5ee2dae",
      "name": "Zu Foxit hochladen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -40,
        -140
      ],
      "parameters": {
        "url": "https://na1.fusion.foxit.com/pdf-services/api/documents/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "genericAuthType": "httpCustomAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "id": "itvQ81oceu7Z42Sz",
          "name": "Custom Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e5227af7-afff-4f6e-af71-097b9b8b414e",
      "name": "Foxit-Extraktion starten",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        180,
        -140
      ],
      "parameters": {
        "url": "https://na1.fusion.foxit.com/pdf-services/api/documents/modify/pdf-extract",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"documentId\": \"{{ $json.documentId }}\",\n  \"extractType\":\"TEXT\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpCustomAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "id": "itvQ81oceu7Z42Sz",
          "name": "Custom Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f0c75b63-c65e-4dc3-acc2-83ba5b7557f2",
      "name": "Aufgabe prüfen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        620,
        -140
      ],
      "parameters": {
        "url": "=https://na1.fusion.foxit.com/pdf-services/api/tasks/{{$json.taskId}}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpCustomAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "id": "itvQ81oceu7Z42Sz",
          "name": "Custom Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d6c0040f-8453-4502-b24c-7ea4fb151b93",
      "name": "Ist der Auftrag abgeschlossen?",
      "type": "n8n-nodes-base.if",
      "position": [
        -420,
        140
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fa958cdc-d7a8-49b9-b577-13429bd7bcf5",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "07a33ebd-53bd-49f9-967e-7c802b8fa162",
      "name": "Warten",
      "type": "n8n-nodes-base.wait",
      "position": [
        -160,
        380
      ],
      "webhookId": "73c776cc-25e1-4543-8a18-48c69a7d6e82",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "535c42f4-bd75-4ab4-8468-5ce253db452f",
      "name": "Extrahierten Text herunterladen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -180,
        100
      ],
      "parameters": {
        "url": "=https://na1.fusion.foxit.com/pdf-services/api/documents/{{ $('Check Task').item.json.resultDocumentId }}/download",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpCustomAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "id": "itvQ81oceu7Z42Sz",
          "name": "Custom Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f4804b68-db6d-4fa0-9d38-e8d339ed949a",
      "name": "Diffbot-Entitäten abrufen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        80,
        100
      ],
      "parameters": {
        "url": "https://nl.diffbot.com/v1/?fields=entities,summary",
        "method": "POST",
        "options": {},
        "jsonBody": "=[{\n  \"content\":{{ JSON.stringify($json.data) }},\n  \"lang\":\"en\",\n  \"format\":\"plain text\"\n}]",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth"
      },
      "credentials": {
        "httpQueryAuth": {
          "id": "oTrsbmKF2Bq7Awce",
          "name": "Query Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e3f7c3da-cda6-4039-84de-b162dae71b64",
      "name": "Daten strukturieren",
      "type": "n8n-nodes-base.code",
      "position": [
        300,
        100
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\n/*\nfor (const item of $input.all()) {\n  console.log('in loop', item);\n  item.json.myNewField = 1;\n}\n*/\nconsole.log('hello ray');\n\nlet organizations = $input.all()[0].json.entities.filter(d => {\n  let hasOrg = false;\n  let isConfident = false;\n  let types = d.allTypes.reduce((names, i) => {\n    names.push(i.name);\n    return names;\n  },[]);\n  if(types.indexOf('organization') >= 0) hasOrg = true;\n  isConfident = d.confidence >= 0.85;\n  return (hasOrg && isConfident);\n});\n\nlet orgNames = organizations.reduce((names, o) => {\n  names.push(o.name);\n  return names;\n}, []);\n\nreturn { organizations:orgNames, summary:$input.all()[0].json.summary }\n"
      },
      "typeVersion": 2
    },
    {
      "id": "540a774b-82ee-41b2-9ac1-b21e30bfa71a",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        720,
        100
      ],
      "webhookId": "d2b05334-9a0c-4795-a508-85fbc49c773d",
      "parameters": {
        "sendTo": "raymondcamden@gmail.com",
        "message": "={{ $json.html }}",
        "options": {},
        "subject": "intelligent Document Report on Upload"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "A7SxJ0FWjVNKGOnA",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "eed7c59c-124e-461c-a7d0-1100376470f1",
      "name": "Haftnotiz",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -320
      ],
      "parameters": {
        "width": 320,
        "content": "## Ingestion\n\nThe workflow kicks off when a new file is added to Google Drive in a particular folder. The data is downloaded to n8n."
      },
      "typeVersion": 1
    },
    {
      "id": "9a39a52d-4765-47ce-91d2-f61b6df47838",
      "name": "Haftnotiz1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -320
      ],
      "parameters": {
        "width": 760,
        "content": "## Uploading and Extracting\nNext, the document is uploaded to Foxit and the Extraction API is fired to get the text. This is an async job so we check the status in a loop."
      },
      "typeVersion": 1
    },
    {
      "id": "fae16938-8a56-45b7-b3cf-87ee7a17ab09",
      "name": "Haftnotiz2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        40,
        280
      ],
      "parameters": {
        "content": "## Analyzing\n\nAfter the Extract result is downloaded, Diffbot is called and asked to analyze and summarize the contents."
      },
      "typeVersion": 1
    },
    {
      "id": "574e824b-1f88-469c-b3e1-662ed7a653c0",
      "name": "Make E-Mail-Inhalte",
      "type": "n8n-nodes-base.code",
      "position": [
        520,
        100
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet input = $input.all()[0].json;\nlet doc = $('Fire on New File in Google Drive Folder').first().json.name;\nlet link = $('Fire on New File in Google Drive Folder').first().json.webViewLink;\n\nlet html = `\n<h2>Docucument Report for <a href=\"${link}\">${doc}</a></h2>\n\n<p>\nThis document discussed the following organizations:\n<ul>\n`;\nlet orgs = input.organizations.reduce((s, o) => {\n  return s + `<li>${o}</li>`;\n},'');\n\nhtml += orgs + `\n</ul>\n\n<p>\nSummary for this document:\n</p>\n<p>\n${input.summary}\n</p>\n`;\n\nreturn { html };"
      },
      "typeVersion": 2
    },
    {
      "id": "bb085e4b-04b3-4d6e-b1a0-722766490849",
      "name": "Haftnotiz3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        280
      ],
      "parameters": {
        "width": 500,
        "content": "## Shaping and Emailing\n\nFinally, we shape the result from Diffbot and create an HTML string that can be used in the email stage."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "85760a47-a1c3-4928-8065-23bd5de0b437",
  "connections": {
    "07a33ebd-53bd-49f9-967e-7c802b8fa162": {
      "main": [
        [
          {
            "node": "f0c75b63-c65e-4dc3-acc2-83ba5b7557f2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f0c75b63-c65e-4dc3-acc2-83ba5b7557f2": {
      "main": [
        [
          {
            "node": "d6c0040f-8453-4502-b24c-7ea4fb151b93",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e3f7c3da-cda6-4039-84de-b162dae71b64": {
      "main": [
        [
          {
            "node": "574e824b-1f88-469c-b3e1-662ed7a653c0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1a016850-c310-43a6-9925-538086367d4f": {
      "main": [
        [
          {
            "node": "8a1bf842-514e-4f28-b799-989de5ee2dae",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8a1bf842-514e-4f28-b799-989de5ee2dae": {
      "main": [
        [
          {
            "node": "e5227af7-afff-4f6e-af71-097b9b8b414e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d6c0040f-8453-4502-b24c-7ea4fb151b93": {
      "main": [
        [
          {
            "node": "535c42f4-bd75-4ab4-8468-5ce253db452f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "07a33ebd-53bd-49f9-967e-7c802b8fa162",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "574e824b-1f88-469c-b3e1-662ed7a653c0": {
      "main": [
        [
          {
            "node": "540a774b-82ee-41b2-9ac1-b21e30bfa71a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f4804b68-db6d-4fa0-9d38-e8d339ed949a": {
      "main": [
        [
          {
            "node": "e3f7c3da-cda6-4039-84de-b162dae71b64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e5227af7-afff-4f6e-af71-097b9b8b414e": {
      "main": [
        [
          {
            "node": "f0c75b63-c65e-4dc3-acc2-83ba5b7557f2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "535c42f4-bd75-4ab4-8468-5ce253db452f": {
      "main": [
        [
          {
            "node": "f4804b68-db6d-4fa0-9d38-e8d339ed949a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e0e1f4a8-973f-44cc-9103-b2a92fa0cd0c": {
      "main": [
        [
          {
            "node": "1a016850-c310-43a6-9925-538086367d4f",
            "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?

Experte - 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
Experte
Anzahl der Nodes16
Kategorie2
Node-Typen8
Schwierigkeitsbeschreibung

Für fortgeschrittene Benutzer, komplexe Workflows mit 16+ Nodes

Autor
Raymond Camden

Raymond Camden

@raymondcamden

As an API Evangelist for Foxit, Raymond Camden specializes in the power of APIs, the web platform, and generative AI. A prolific author and seasoned presenter, he has been a prominent voice in the developer community for over two decades. You can explore his work and insights on his long-running blog at www.raymondcamden.com or reach him directly at raymondcamden@gmail.com.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34