This workflow corresponds to n8n.io template #9447 — we link there as the canonical source.
This workflow follows the Gmail → Google Drive recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "Rrs4ZCaJZKAZIHKG",
"name": "Automated Invoice Generation & Delivery for Jotform Orders",
"tags": [
{
"id": "TDW7E4RVCMchXf5b",
"name": "published",
"createdAt": "2025-10-13T01:18:01.305Z",
"updatedAt": "2025-10-13T01:18:01.305Z"
}
],
"nodes": [
{
"id": "99ab3063-af31-4701-890f-67b42ed901f6",
"name": "Format Invoice Data",
"type": "n8n-nodes-base.code",
"position": [
-160,
496
],
"parameters": {
"jsCode": "// Extract and format order data for invoice\nconst orderData = $input.first().json.body;\n\n// Calculate totals\nconst lineItems = orderData.line_items.map(item => ({\n name: item.name,\n quantity: item.quantity,\n price: parseFloat(item.price),\n total: parseFloat(item.price) * item.quantity,\n sku: item.sku || 'N/A'\n}));\n\nconst subtotal = lineItems.reduce((sum, item) => sum + item.total, 0);\nconst taxAmount = parseFloat(orderData.total_tax || 0);\nconst shippingAmount = parseFloat(orderData.shipping_lines?.[0]?.price || 0);\nconst total = parseFloat(orderData.total_price);\n\n// Format invoice data\nconst invoiceData = {\n // Order info\n orderNumber: orderData.order_number,\n orderDate: new Date(orderData.created_at).toLocaleDateString(),\n \n // Customer info\n customer: {\n name: `${orderData.customer.first_name} ${orderData.customer.last_name}`,\n email: orderData.customer.email,\n phone: orderData.customer.phone || 'N/A'\n },\n \n // Billing address\n billingAddress: orderData.billing_address ? {\n address1: orderData.billing_address.address1,\n address2: orderData.billing_address.address2 || '',\n city: orderData.billing_address.city,\n province: orderData.billing_address.province,\n zip: orderData.billing_address.zip,\n country: orderData.billing_address.country\n } : null,\n \n // Shipping address\n shippingAddress: orderData.shipping_address ? {\n address1: orderData.shipping_address.address1,\n address2: orderData.shipping_address.address2 || '',\n city: orderData.shipping_address.city,\n province: orderData.shipping_address.province,\n zip: orderData.shipping_address.zip,\n country: orderData.shipping_address.country\n } : null,\n \n // Line items\n items: lineItems,\n \n // Totals\n subtotal: subtotal.toFixed(2),\n tax: taxAmount.toFixed(2),\n shipping: shippingAmount.toFixed(2),\n total: total.toFixed(2),\n currency: orderData.currency,\n \n // Additional info\n paymentMethod: orderData.payment_gateway_names?.[0] || 'Online Payment',\n notes: orderData.note || ''\n};\n\nreturn { invoiceData };"
},
"typeVersion": 2
},
{
"id": "0bfdcf22-ecc4-4fb1-b9a7-5ee86079feb1",
"name": "Generate HTML Invoice",
"type": "n8n-nodes-base.code",
"position": [
144,
496
],
"parameters": {
"jsCode": "// Generate professional invoice HTML\nconst data = $input.first().json.invoiceData;\n\nconst html = `\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Invoice #${data.orderNumber}</title>\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n \n body {\n font-family: 'Arial', sans-serif;\n line-height: 1.6;\n color: #333;\n background: #f8f9fa;\n }\n \n .container {\n max-width: 800px;\n margin: 0 auto;\n background: white;\n padding: 40px;\n box-shadow: 0 0 20px rgba(0,0,0,0.1);\n }\n \n .header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 40px;\n padding-bottom: 20px;\n border-bottom: 3px solid #007bff;\n }\n \n .company-info {\n flex: 1;\n }\n \n .company-name {\n font-size: 28px;\n font-weight: bold;\n color: #007bff;\n margin-bottom: 5px;\n }\n \n .invoice-info {\n text-align: right;\n }\n \n .invoice-title {\n font-size: 36px;\n font-weight: bold;\n color: #333;\n margin-bottom: 10px;\n }\n \n .invoice-number {\n font-size: 18px;\n color: #666;\n }\n \n .details-section {\n display: flex;\n justify-content: space-between;\n margin-bottom: 40px;\n gap: 40px;\n }\n \n .detail-box {\n flex: 1;\n padding: 20px;\n background: #f8f9fa;\n border-radius: 8px;\n }\n \n .detail-title {\n font-weight: bold;\n margin-bottom: 15px;\n color: #007bff;\n font-size: 16px;\n }\n \n .detail-content {\n color: #555;\n }\n \n .items-table {\n width: 100%;\n border-collapse: collapse;\n margin-bottom: 30px;\n }\n \n .items-table th,\n .items-table td {\n padding: 15px;\n text-align: left;\n border-bottom: 1px solid #ddd;\n }\n \n .items-table th {\n background-color: #007bff;\n color: white;\n font-weight: bold;\n text-transform: uppercase;\n font-size: 14px;\n }\n \n .items-table tr:hover {\n background-color: #f5f5f5;\n }\n \n .text-right {\n text-align: right;\n }\n \n .totals-section {\n margin-left: auto;\n width: 300px;\n }\n \n .totals-table {\n width: 100%;\n border-collapse: collapse;\n }\n \n .totals-table td {\n padding: 10px 0;\n border-bottom: 1px solid #eee;\n }\n \n .total-row {\n font-weight: bold;\n font-size: 18px;\n border-top: 2px solid #007bff;\n color: #007bff;\n }\n \n .footer {\n margin-top: 50px;\n padding-top: 20px;\n border-top: 1px solid #ddd;\n text-align: center;\n color: #666;\n font-size: 14px;\n }\n \n .thank-you {\n font-size: 18px;\n color: #007bff;\n margin-bottom: 10px;\n }\n </style>\n</head>\n<body>\n <div class=\"container\">\n <div class=\"header\">\n <div class=\"company-info\">\n <div class=\"company-name\">Your Company Name</div>\n <div>123 Business Street</div>\n <div>City, State 12345</div>\n <div>Phone: (555) 123-4567</div>\n <div>Email: user@example.com</div>\n </div>\n <div class=\"invoice-info\">\n <div class=\"invoice-title\">INVOICE</div>\n <div class=\"invoice-number\">#${data.orderNumber}</div>\n <div style=\"margin-top: 10px;\">Date: ${data.orderDate}</div>\n </div>\n </div>\n \n <div class=\"details-section\">\n <div class=\"detail-box\">\n <div class=\"detail-title\">Bill To:</div>\n <div class=\"detail-content\">\n <strong>${data.customer.name}</strong><br>\n ${data.customer.email}<br>\n ${data.customer.phone}<br><br>\n ${data.billingAddress ? `\n ${data.billingAddress.address1}<br>\n ${data.billingAddress.address2 ? data.billingAddress.address2 + '<br>' : ''}\n ${data.billingAddress.city}, ${data.billingAddress.province} ${data.billingAddress.zip}<br>\n ${data.billingAddress.country}\n ` : ''}\n </div>\n </div>\n \n ${data.shippingAddress ? `\n <div class=\"detail-box\">\n <div class=\"detail-title\">Ship To:</div>\n <div class=\"detail-content\">\n ${data.shippingAddress.address1}<br>\n ${data.shippingAddress.address2 ? data.shippingAddress.address2 + '<br>' : ''}\n ${data.shippingAddress.city}, ${data.shippingAddress.province} ${data.shippingAddress.zip}<br>\n ${data.shippingAddress.country}\n </div>\n </div>\n ` : ''}\n \n <div class=\"detail-box\">\n <div class=\"detail-title\">Payment Info:</div>\n <div class=\"detail-content\">\n <strong>Method:</strong> ${data.paymentMethod}<br>\n <strong>Currency:</strong> ${data.currency}<br>\n <strong>Status:</strong> Paid\n </div>\n </div>\n </div>\n \n <table class=\"items-table\">\n <thead>\n <tr>\n <th>Item</th>\n <th>SKU</th>\n <th>Qty</th>\n <th>Price</th>\n <th>Total</th>\n </tr>\n </thead>\n <tbody>\n ${data.items.map(item => `\n <tr>\n <td><strong>${item.name}</strong></td>\n <td>${item.sku}</td>\n <td>${item.quantity}</td>\n <td>$${item.price.toFixed(2)}</td>\n <td class=\"text-right\">$${item.total.toFixed(2)}</td>\n </tr>\n `).join('')}\n </tbody>\n </table>\n \n <div class=\"totals-section\">\n <table class=\"totals-table\">\n <tr>\n <td>Subtotal:</td>\n <td class=\"text-right\">$${data.subtotal}</td>\n </tr>\n ${parseFloat(data.shipping) > 0 ? `\n <tr>\n <td>Shipping:</td>\n <td class=\"text-right\">$${data.shipping}</td>\n </tr>\n ` : ''}\n ${parseFloat(data.tax) > 0 ? `\n <tr>\n <td>Tax:</td>\n <td class=\"text-right\">$${data.tax}</td>\n </tr>\n ` : ''}\n <tr class=\"total-row\">\n <td><strong>Total:</strong></td>\n <td class=\"text-right\"><strong>$${data.total}</strong></td>\n </tr>\n </table>\n </div>\n \n ${data.notes ? `\n <div style=\"margin-top: 30px; padding: 20px; background: #f8f9fa; border-radius: 8px;\">\n <strong>Notes:</strong><br>\n ${data.notes}\n </div>\n ` : ''}\n \n <div class=\"footer\">\n <div class=\"thank-you\">Thank you for your business!</div>\n <div>This invoice was generated automatically on ${new Date().toLocaleDateString()}</div>\n <div style=\"margin-top: 10px;\">For questions about this invoice, please contact us at user@example.com</div>\n </div>\n </div>\n</body>\n</html>\n`;\n\nreturn { html };"
},
"typeVersion": 2
},
{
"id": "9cedf436-1a03-4fb6-910d-086b6dca81b5",
"name": "Save to Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
1056,
288
],
"parameters": {
"name": "=Invoice - {{ $('Shopify Order Webhook').item.json.body.id }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1A2B3C4D5E6F7G8H9I0J",
"cachedResultName": "Invoices"
}
},
"typeVersion": 3
},
{
"id": "cfc5e050-ca7f-4197-aec2-efea24529538",
"name": "Email to Customer",
"type": "n8n-nodes-base.gmail",
"position": [
1056,
592
],
"parameters": {
"sendTo": "={{ $('Shopify Order Webhook').item.json.body.customer.email }}",
"message": "=<!DOCTYPE html> <html lang=\"en\"> <head> <meta charset=\"UTF-8\"> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> <title>Invoice for Order #{{ $('Shopify Order Webhook').item.json.body.order_number }}</title> <style> body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 20px; } .header { text-align: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 2px solid #007bff; } .company-name { font-size: 24px; font-weight: bold; color: #007bff; margin-bottom: 5px; } .attachment-notice { background: #f8f9fa; padding: 15px; border-left: 4px solid #28a745; margin: 20px 0; } .footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid #ddd; color: #666; font-size: 14px; } </style> </head> <body> <div class=\"header\"> <div class=\"company-name\">Company Name</div> </div> <p>Dear {{ $('Shopify Order Webhook').item.json.body.customer.first_name }},</p> <p>Thank you for your recent order! Your payment has been successfully processed.</p> <div class=\"attachment-notice\"> <strong>\ud83d\udcce Invoice Attached</strong><br> Please find your invoice attached to this email for order #{{ $('Shopify Order Webhook').item.json.body.order_number }}. </div> <p>We're now preparing your order for shipment. You'll receive a tracking notification once your order is on its way.</p> <p>If you have any questions about your order, please don't hesitate to contact us at support@pdfmunk.com.</p> <p>Thank you for choosing Company Name!</p> <p>Best regards,<br> The Company Name Team</p> <div class=\"footer\"> <p>This is an automated email regarding your order. Please save the attached invoice for your records.</p> </div> </body> </html>",
"options": {
"attachmentsUi": {
"attachmentsBinary": [
{}
]
}
},
"subject": "=Invoice for your Order# {{ $('Shopify Order Webhook').item.json.body.order_number }}"
},
"typeVersion": 2.1
},
{
"id": "8162eb8b-938d-4361-b54d-e745984ba8b1",
"name": "Generate PDF Invoice",
"type": "n8n-nodes-htmlcsstopdf.htmlcsstopdf",
"position": [
512,
496
],
"parameters": {},
"typeVersion": 1
},
{
"id": "23581c69-fd48-49a9-abe8-8f3efb1bcc9e",
"name": "Download File PDF",
"type": "n8n-nodes-base.httpRequest",
"position": [
800,
496
],
"parameters": {
"url": "={{ $json.pdf_url }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "6ff41885-733c-4e38-b16b-3e9f3adae96b",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-592,
288
],
"parameters": {
"color": 4,
"width": 288,
"height": 368,
"content": "## Webhook from Jotform\nSetup this webhook URL to receive order information from Jotform\n\n**Jotform account**\n\n[Sign up for Jotform for free](https://www.jotform.com/?partner=mediajade)"
},
"typeVersion": 1
},
{
"id": "5ddc5e49-007b-4a46-a41a-e7f5a50c2679",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
384
],
"parameters": {
"color": 4,
"height": 272,
"content": "## Create HTML\nGenerate custom HTML for the invoice"
},
"typeVersion": 1
},
{
"id": "989e9a89-dcd8-42fb-9fa6-c20916ef42f5",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
384,
384
],
"parameters": {
"color": 4,
"width": 352,
"height": 272,
"content": "## Generate PDF\n* Convert HTML to PDF Invoice\n* Get your API Key from [PDFMunk](https://pdfmunk.com)"
},
"typeVersion": 1
},
{
"id": "8aeeed1b-3c2f-44de-a330-2547f2d1a3bd",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-224,
384
],
"parameters": {
"color": 4,
"height": 272,
"content": "## Format Data\nPrepare Line Item data for next step"
},
"typeVersion": 1
},
{
"id": "db3b1636-c5c8-4212-8cfa-8a1d4e21410e",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
960,
576
],
"parameters": {
"color": 4,
"width": 304,
"height": 288,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n## Email Invoice\nSend Invoice PDF Email to the Customer"
},
"typeVersion": 1
},
{
"id": "6d92f3cf-4574-44af-b88a-e309974f809b",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
960,
192
],
"parameters": {
"color": 4,
"width": 304,
"height": 288,
"content": "## Save Invoice PDF\nStore Invoice PDF to Google Drive"
},
"typeVersion": 1
},
{
"id": "bfc8cada-2bd0-485f-a9b5-4d1701474374",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
0
],
"parameters": {
"color": 6,
"width": 544,
"height": 288,
"content": "## \ud83c\udfaf What This Template Does\n\nTransform your Jotform order fulfillment with complete invoice automation. When a customer places an order, this workflow automatically:\n\n\u2705 Receives order data from Jotform Trigger\n\u2705 Generates professional HTML invoice with your branding\n\u2705 Converts to PDF using HTML to PDF conversion\n\u2705 Saves invoice to Google Drive for record-keeping\n\u2705 Emails PDF invoice to customer automatically"
},
"typeVersion": 1
},
{
"id": "000cdfd3-ae0d-4716-9ca9-ef155ff6c3ec",
"name": "Jotform Trigger",
"type": "n8n-nodes-base.jotFormTrigger",
"position": [
-512,
496
],
"parameters": {
"form": "252815424602048"
},
"credentials": {
"jotFormApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "311c560b-285d-4fe7-a19f-3c8c236478cf",
"connections": {
"Jotform Trigger": {
"main": [
[
{
"node": "Format Invoice Data",
"type": "main",
"index": 0
}
]
]
},
"Download File PDF": {
"main": [
[
{
"node": "Email to Customer",
"type": "main",
"index": 0
},
{
"node": "Save to Google Drive",
"type": "main",
"index": 0
}
]
]
},
"Email to Customer": {
"main": [
[]
]
},
"Format Invoice Data": {
"main": [
[
{
"node": "Generate HTML Invoice",
"type": "main",
"index": 0
}
]
]
},
"Generate PDF Invoice": {
"main": [
[
{
"node": "Download File PDF",
"type": "main",
"index": 0
}
]
]
},
"Save to Google Drive": {
"main": [
[]
]
},
"Generate HTML Invoice": {
"main": [
[
{
"node": "Generate PDF Invoice",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
jotFormApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Transform your order fulfillment process with complete invoice automation. This workflow automatically generates professional PDF invoices from Jotform orders and delivers them to customers while keeping organized records.
Source: https://n8n.io/workflows/9447/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Transform your event registration process with this comprehensive automation that eliminates manual certificate creation and ensures only verified attendees receive credentials.
A comprehensive n8n workflow template that completely automates the startup pitch deck submission process for accelerators, incubators, VC firms, and startup competitions. This workflow validates foun
This workflow automates the entire parent consent process for school field trips, replacing manual paper forms with a secure, verified, and legally compliant digital system.
Transform new hire onboarding from 3-4 hours of manual document compilation to 3 minutes of automated generation - creates personalized, role-specific document packages including welcome letters, bene
Automatically generate professional PDF invoices when new orders are placed in Shopify. This template creates beautifully formatted invoices from order data, converts them to PDF, saves to Google Driv