Hello, here is the Json file and the flow of what I’m trying to accomplish -
{ "name": "Document Summary AI Automation", "nodes": [ { "parameters": { "path": "upload-summary", "responseMode": "onReceived", "responseData": "firstEntryJson", "options": {} }, "name": "Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 1, "position": [200, 300], "webhookId": "unique-webhook-id" }, { "parameters": { "authentication": "headerAuth", "url": "https://api.pdf.co/v1/pdf/convert/to/text", "method": "POST", "responseFormat": "json", "jsonParameters": true, "options": {}, "bodyParametersJson": "{\n \"url\": \"{{$binary.data.data}}\",\n \"inline\": true,\n \"ocr\": true,\n \"pages\": \"all\"\n}", "headerParametersJson": "{\n \"x-api-key\": \"YOUR_PDFCO_API_KEY\",\n \"Content-Type\": \"application/json\"\n}" }, "name": "PDF.co Text Extraction", "type": "n8n-nodes-base.httpRequest", "typeVersion": 1, "position": [400, 300], "credentials": { "httpHeaderAuth": { "id": "pdfco-creds", "name": "PDFco API" } } }, { "parameters": { "model": "gpt-4", "temperature": 0.4, "maxTokens": 2000, "systemMessage": "You are a legal and business document interpreter.", "messages": [ { "role": "user", "content": "Analyze the following document and break it down into:\n\n1. Summary – Simple explanation of what the document is.\n2. Watch Out – Risks, tricky language, or fine print.\n3. Questions to Ask – Smart follow-ups.\n4. Important Details – All dates, names, deadlines, amounts, etc.\n\n{{$node[\"PDF.co Text Extraction\"].json[\"body\"]}}" } ] }, "name": "OpenAI Summary", "type": "n8n-nodes-base.openai", "typeVersion": 1, "position": [600, 300], "credentials": { "openAiApi": { "id": "openai-creds", "name": "OpenAI API" } } }, { "parameters": { "html": "Document Summary
{{$json[\"message\"]}}
", "options": {} }, "name": "HTML to PDF", "type": "n8n-nodes-base.htmlPdf", "typeVersion": 1, "position": [800, 300] }, { "parameters": { "fromEmail": "[email protected]", "toEmail": "{{$json[\"email\"]}}", "subject": "Your Simplified Document Summary is Ready", "text": "Attached is the professional summary of your uploaded document.", "attachments": [ { "binaryPropertyName": "data" } ] }, "name": "Send Email", "type": "n8n-nodes-base.emailSend", "typeVersion": 1, "position": [1000, 300], "credentials": { "smtp": { "id": "email-creds", "name": "SMTP Account" } } } ], "connections": { "Webhook": { "main": [ [ { "node": "PDF.co Text Extraction", "type": "main", "index": 0 } ] ] }, "PDF.co Text Extraction": { "main": [ [ { "node": "OpenAI Summary", "type": "main", "index": 0 } ] ] }, "OpenAI Summary": { "main": [ [ { "node": "HTML to PDF", "type": "main", "index": 0 } ] ] }, "HTML to PDF": { "main": [ [ { "node": "Send Email", "type": "main", "index": 0 } ] ] } } }
How the Workflow Should Function
- Trigger:
A customer uploads a document through my website after payment is processed. The upload triggers the n8n workflow via a Webhook. - Document Handling:
- Accepts multiple formats: PDF, Word (DOC/DOCX), or clear image files (JPEG/PNG)
- Workflow identifies the file type and sends it to the correct text extraction module:
- PDFs → PDF Extract
- Word Docs → LibreOffice Convert
- Images → Tesseract OCR
**** PDF.CO might handle all of these different file requests****
- AI Processing:
-
The raw extracted text is passed into ChatGPT (OpenAI) or Gemini (Google AI) via n8n’s OpenAI node or HTTP Request to Gemini API
-
The AI model returns a structured summary with the following key sections:
- Summary – An easy-to-understand breakdown of the document
- Watch Out – Hidden risks, tricky language, or legal red flags
- Questions to Ask – Suggested questions the user should ask for clarity
- Important Details – Key info like deadlines, phone numbers, names, amounts, etc.
- PDF Generation:
- The structured AI response is sent to Bannerbear, Canva, or PDF Generator API
- A beautiful, professional report is generated from a branded template
- Delivery:
- The final PDF is sent to the customer via email, using n8n’s Gmail, SMTP, or Mailgun node
- Optional Logging:
- Log all submissions and outputs into Google Sheets, Airtable, or a database for tracking and analytics
|Step|Description|Node Type|
|1|Trigger: Customer uploads document (PDF/DOCX/Image) after payment via website form|Webhook Node|
|2|Send File to PDF.co for OCR/Text Extraction|HTTP Request Node|
|3|Extract body.text from PDF.co Response|Set / Function Node|
|4|Send extracted text to OpenAI for analysis (summary, risks, questions, details)|OpenAI Node|
|5|Convert AI output into a styled HTML|Set Node (with HTML template)|
|6|Generate PDF using Bannerbear or PDF.co HTML-to-PDF|HTTP Request Node|
|7|Email Final PDF to User|Gmail / Mailgun / SMTP Node|
|8|(Optional) Log info to Google Sheets or Airtable|Google Sheets Node|