Templates / Generate branded PDF reports from incoming emails using Autype and OpenRouter

Generate branded PDF reports from incoming emails using Autype and OpenRouter

Needs changes

by 8Automator ✓ · 15 views · created 2026-03-19 · Document Extraction, Multimodal AI

Needs changes. This template uses 1 thing(s) that n8n 3.0 removes: SerpApi (Google Search). 1 breaking item(s) found. Static check, last run 2026-10-19.

What to replace before upgrading

Removed in 3.0Replace with
SerpApi (Google Search)
SerpAPI
No direct replacement: call the SerpApi REST API with an HTTP Request tool, or use a verified community node

Community nodes

These come from third-party npm packages. In n8n 3.0 unverified community packages are off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).

Nodes used (13)

AI AgentOpenRouter Chat ModelSerpApi (Google Search)

What it does

!Workflow n8n screenshot(fileId:4992) ⚠️ Important: This workflow uses the Autype community node and requires a self-hosted n8n instance. Send an email with a document request and optional PDF attachments. The AI assistant can summarize documents, compare multiple PDFs, draft new content, or create documents from scratch with internet research — all output as professionally branded PDFs using Autype. The finished document is delivered back to the sender via email. Who is this for? Consultants, analysts, project managers, and teams who need on-demand document generation. Send an email and get a branded PDF back — whether it's a summary, comparison, draft, or a freshly researched document. Concrete example: Attach 3 PDF proposals and write "Compare these proposals and recommend the best option" — each PDF is OCR'd via Autype Lens, the AI assistant produces a structured comparison with tables, and you receive a branded PDF within minutes. This also works as an additional skill for an AI agent. Instead of an email trigger, connect the workflow to a webhook or chat trigger so an agent can call it when a user asks "create a summary of these documents." What this workflow does On each incoming email, the workflow: 1. Extracts the email subject + body as the document request, and detects PDF attachments 2. Processes each attached PDF sequentially: uploads to Autype, extracts text via Lens OCR 3. Combines all OCR results into a single context 4. Downloads the Autype Extended Markdown syntax reference so the AI knows the output format 5. Passes the request text + all PDF content to an AI Document Assistant with Firecrawl and SerpAPI as research tools 6. The assistant determines the task type (summarize, compare, draft, or create from scratch) and produces the document in Autype Extended Markdown 7. Autype renders the markdown to a branded PDF with company styling (fonts, colors, heading styles, tables, header with logo, footer with page numbers) 8. The PDF is delivered back to the original sender via email Output structure !output structure diagram(fileId:4991) How it works 1. New Email Received — An IMAP Email Trigger monitors your inbox for incoming document requests. The email subject and body become the request text; PDF attachments are automatically detected. 2. Set Company Config — A Set node defines your company name, logo URL, and brand color. Edit these values once. 3. Extract & Split PDFs — A Code node extracts the sender email, combines subject + body as request text, and detects PDF attachments. Each PDF is split into a separate item for loop processing. If no PDFs are attached, a single item with just the text is output. 4. Has PDFs? — An IF node routes the flow: emails with PDF attachments enter the processing loop, text-only emails skip directly to the AI Assistant. 5. Loop Over PDFs — A Split In Batches node processes each PDF sequentially (one at a time to avoid API rate limits). 6. Upload PDF to Autype — Each PDF is uploaded to Autype via the community node (resource: file). 7. Autype Lens OCR — An HTTP Request node triggers Autype Lens OCR on the uploaded file with outputFormat: "md". This uses Generic Auth Type → Header Auth with X-API-Key set to your Autype API key. Cost: 4 credits per page. A dedicated community node for Lens is planned. 8. Wait for OCR → Poll OCR Status — Waits 8 seconds, then polls the job status via HTTP Request (same Header Auth credential). The loop continues to the next PDF after each OCR completes. 9. Extract OCR Text — Extracts the markdown text from each OCR result and stores it with the original filename. 10. Combine All OCR Results — After the loop completes, collects all OCR texts and combines them into a single context string with labeled sections per PDF. 11. Prepare Text Only — For emails without PDFs, passes just the request text forward. 12. Download Markdown Syntax — Fetches the Autype Extended Markdown syntax reference so the AI knows the output format. 13. Merge Context — Combin

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.