Generate branded invoice PDFs from webhook orders with PolyDoc and email
Quick overview This workflow receives an order via webhook, validates required fields, calculates invoice totals, renders a branded invoice PDF using a saved PolyDoc template, emails the PDF to the customer, and returns the same PDF in the webhook response.
How it works Receives an order payload in a POST request via an n8n webhook. Validates that the order includes at least one line item and a customer email, and returns a 422 JSON error if the payload is incomplete. Calculates line totals, subtotal, tax amount, and grand total, and formats the invoice data (invoice number, dates, currency, and customer details). Uses PolyDoc to populate a saved template with the invoice data and render an A4 PDF. Sends the generated PDF to the customer by email as an attachment. Returns the generated PDF as the webhook response for immediate download.
Setup Create a PolyDoc API credential in n8n and replace YOUR_TEMPLATE_ID with your saved invoice template ID from the PolyDoc dashboard. Configure an SMTP credential (or replace the email step with another provider) and set the sender address (for example, update billing@example.com). Copy the webhook URL from the webhook trigger and configure your store/checkout/CRM to POST orders to it using the expected order structure (including order.lines and order.customer.email).
Related Templates
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
Generate Product Ad Copy & CTAs with GPT-4 for Slack and Airtable
⚡ AI Copywriter Pro: Instant Ad Copy & CTA Generator Transform product details into compelling marketing copy in second...
Generate Food Recipes from Gmail & Form Requests with Ollama & Llama 3.2
This n8n template demonstrates how to create an intelligent food recipe assistant that accepts requests via Gmail and we...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments