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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "AI_Invoice_PDF_Generator",
|
| 3 |
+
"nodes": [
|
| 4 |
+
{
|
| 5 |
+
"parameters": {
|
| 6 |
+
"updates": [
|
| 7 |
+
"message"
|
| 8 |
+
],
|
| 9 |
+
"additionalFields": {}
|
| 10 |
+
},
|
| 11 |
+
"id": "80b8584c-cfbf-4c38-9e42-fbd2a6492d75",
|
| 12 |
+
"name": "π± Telegram Trigger",
|
| 13 |
+
"type": "n8n-nodes-base.telegramTrigger",
|
| 14 |
+
"typeVersion": 1.2,
|
| 15 |
+
"position": [
|
| 16 |
+
-1080,
|
| 17 |
+
-60
|
| 18 |
+
],
|
| 19 |
+
"webhookId": "ai-invoice-bot",
|
| 20 |
+
"credentials": {
|
| 21 |
+
"telegramApi": {
|
| 22 |
+
"id": "Cg9dM7bNcPpXNS5R",
|
| 23 |
+
"name": "Telegram account"
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"parameters": {
|
| 29 |
+
"rules": {
|
| 30 |
+
"values": [
|
| 31 |
+
{
|
| 32 |
+
"conditions": {
|
| 33 |
+
"options": {
|
| 34 |
+
"caseSensitive": true,
|
| 35 |
+
"leftValue": "",
|
| 36 |
+
"typeValidation": "strict",
|
| 37 |
+
"version": 1
|
| 38 |
+
},
|
| 39 |
+
"conditions": [
|
| 40 |
+
{
|
| 41 |
+
"id": "check-start",
|
| 42 |
+
"leftValue": "={{ $json.message?.text }}",
|
| 43 |
+
"rightValue": "start",
|
| 44 |
+
"operator": {
|
| 45 |
+
"type": "string",
|
| 46 |
+
"operation": "contains"
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
],
|
| 50 |
+
"combinator": "and"
|
| 51 |
+
},
|
| 52 |
+
"renameOutput": true,
|
| 53 |
+
"outputKey": "welcome"
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"conditions": {
|
| 57 |
+
"options": {
|
| 58 |
+
"caseSensitive": true,
|
| 59 |
+
"leftValue": "",
|
| 60 |
+
"typeValidation": "strict",
|
| 61 |
+
"version": 1
|
| 62 |
+
},
|
| 63 |
+
"conditions": [
|
| 64 |
+
{
|
| 65 |
+
"id": "check-invoice",
|
| 66 |
+
"leftValue": "={{ $json.message?.text }}",
|
| 67 |
+
"rightValue": "/start",
|
| 68 |
+
"operator": {
|
| 69 |
+
"type": "string",
|
| 70 |
+
"operation": "notEquals"
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
],
|
| 74 |
+
"combinator": "and"
|
| 75 |
+
},
|
| 76 |
+
"renameOutput": true,
|
| 77 |
+
"outputKey": "invoice_request"
|
| 78 |
+
}
|
| 79 |
+
]
|
| 80 |
+
},
|
| 81 |
+
"options": {}
|
| 82 |
+
},
|
| 83 |
+
"id": "38586a8b-9265-4d11-8f67-3bdafbbd5a9b",
|
| 84 |
+
"name": "π Route Messages",
|
| 85 |
+
"type": "n8n-nodes-base.switch",
|
| 86 |
+
"typeVersion": 3,
|
| 87 |
+
"position": [
|
| 88 |
+
-780,
|
| 89 |
+
-60
|
| 90 |
+
]
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"parameters": {
|
| 94 |
+
"chatId": "={{ $json.message.chat.id }}",
|
| 95 |
+
"text": "π€ **Processing your invoice...**\n\nβ‘ AI is analyzing your request...",
|
| 96 |
+
"additionalFields": {
|
| 97 |
+
"appendAttribution": false,
|
| 98 |
+
"parse_mode": "Markdown"
|
| 99 |
+
}
|
| 100 |
+
},
|
| 101 |
+
"id": "24de848c-8d10-4bd5-a56e-04c30a1acfae",
|
| 102 |
+
"name": "β‘ Processing Message",
|
| 103 |
+
"type": "n8n-nodes-base.telegram",
|
| 104 |
+
"typeVersion": 1.2,
|
| 105 |
+
"position": [
|
| 106 |
+
-460,
|
| 107 |
+
80
|
| 108 |
+
],
|
| 109 |
+
"webhookId": "ce4260e7-f933-4155-b514-dcc942ff6993",
|
| 110 |
+
"credentials": {
|
| 111 |
+
"telegramApi": {
|
| 112 |
+
"id": "Cg9dM7bNcPpXNS5R",
|
| 113 |
+
"name": "Telegram account"
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"parameters": {
|
| 119 |
+
"promptType": "define",
|
| 120 |
+
"text": "={{ $('π± Telegram Trigger').item.json.message.text }}",
|
| 121 |
+
"hasOutputParser": true,
|
| 122 |
+
"options": {
|
| 123 |
+
"systemMessage": "=You are an expert invoice data extraction AI. Extract invoice details from the user's message and return structured JSON data.\n\nRules:\n- Generate invoice number as 'INV-' + current year + random 4 digits (e.g., INV-20251234)\n- Set invoice_date to today's date {{ $now.format('yyyy-MM-dd') }} in YYYY-MM-DD format \n- If no due date mentioned, set 30 days from today in YYYY-MM-DD format\n- Calculate subtotal from all items\n- Apply 10% tax rate unless specified otherwise\n- Calculate total = subtotal + tax_amount\n- Default quantity to 1 if not specified\n- Be smart about parsing rates (hourly rates, project rates, fixed amounts)\n- If client name not clear, use 'Valued Customer'\n- If no email provided, use 'client@example.com'\n- Always include at least one item in the items array\n\nReturn ONLY valid JSON matching this exact structure."
|
| 124 |
+
}
|
| 125 |
+
},
|
| 126 |
+
"id": "6ff32ddd-4dde-442a-aac7-b386542b3694",
|
| 127 |
+
"name": "π§ AI Invoice Agent",
|
| 128 |
+
"type": "@n8n/n8n-nodes-langchain.agent",
|
| 129 |
+
"typeVersion": 2,
|
| 130 |
+
"position": [
|
| 131 |
+
-120,
|
| 132 |
+
-100
|
| 133 |
+
]
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"parameters": {
|
| 137 |
+
"jsonSchemaExample": "{\n \"client_name\": \"John Doe\",\n \"client_email\": \"john@example.com\",\n \"invoice_number\": \"INV-20251234\",\n \"invoice_date\": \"2025-01-20\",\n \"due_date\": \"2025-02-19\",\n \"items\": [\n {\n \"description\": \"Web Design Services\",\n \"quantity\": 1,\n \"rate\": 2500,\n \"amount\": 2500\n }\n ],\n \"subtotal\": 2500,\n \"tax_rate\": 0.1,\n \"tax_amount\": 250,\n \"total\": 2750,\n \"notes\": \"Thank you for your business!\"\n}"
|
| 138 |
+
},
|
| 139 |
+
"id": "c1aa6a20-4375-4ff0-9eb1-b6e073fca1ac",
|
| 140 |
+
"name": "π Extract Invoice Data",
|
| 141 |
+
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
| 142 |
+
"typeVersion": 1.2,
|
| 143 |
+
"position": [
|
| 144 |
+
100,
|
| 145 |
+
140
|
| 146 |
+
]
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"parameters": {
|
| 150 |
+
"html": "<!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 {{ $json.output.invoice_number }}</title>\n <style>\n * { margin: 0; padding: 0; box-sizing: border-box; }\n body { \n font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; \n line-height: 1.6; \n color: #2c3e50; \n background: #ffffff;\n font-size: 14px;\n }\n .container { \n max-width: 800px; \n margin: 0 auto; \n padding: 60px 40px;\n background: #ffffff;\n }\n \n /* Header Section */\n .header {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n margin-bottom: 80px;\n }\n .invoice-title {\n font-size: 3.5rem;\n font-weight: 300;\n color: #1abc9c;\n font-style: italic;\n letter-spacing: -1px;\n }\n .invoice-meta {\n text-align: right;\n color: #7f8c8d;\n font-size: 13px;\n }\n .invoice-meta p {\n margin: 4px 0;\n }\n .invoice-number {\n font-weight: 600;\n color: #2c3e50;\n }\n \n /* Company and Client Info */\n .info-section {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 100px;\n margin-bottom: 80px;\n }\n .company-info, .client-info {\n font-size: 13px;\n line-height: 1.8;\n }\n .company-info {\n color: #7f8c8d;\n }\n .client-info {\n text-align: right;\n color: #2c3e50;\n font-weight: 500;\n }\n .client-name {\n font-weight: 700;\n font-size: 14px;\n margin-bottom: 8px;\n }\n \n /* Items Table */\n .items-section {\n margin: 80px 0;\n }\n .table-header {\n display: grid;\n grid-template-columns: 2fr 1fr 1fr 1fr;\n padding: 0 0 20px 0;\n border-bottom: 1px solid #ecf0f1;\n margin-bottom: 30px;\n font-size: 11px;\n font-weight: 600;\n color: #7f8c8d;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n }\n .table-row {\n display: grid;\n grid-template-columns: 2fr 1fr 1fr 1fr;\n padding: 20px 0;\n border-bottom: 1px solid #f8f9fa;\n align-items: center;\n font-size: 13px;\n }\n .table-row:last-child {\n border-bottom: none;\n }\n .item-description {\n color: #2c3e50;\n font-weight: 500;\n }\n .item-price, .item-quantity {\n color: #7f8c8d;\n text-align: center;\n }\n .item-subtotal {\n text-align: right;\n font-weight: 600;\n color: #1abc9c;\n font-size: 14px;\n }\n \n /* Tax and Total Section */\n .calculation-section {\n margin: 40px 0 80px 0;\n display: flex;\n justify-content: flex-end;\n }\n .totals-table {\n width: 300px;\n }\n .totals-row {\n display: flex;\n justify-content: space-between;\n padding: 8px 0;\n font-size: 13px;\n color: #7f8c8d;\n }\n .subtotal-row {\n border-bottom: 1px solid #ecf0f1;\n margin-bottom: 8px;\n padding-bottom: 12px;\n }\n .tax-row {\n margin-bottom: 12px;\n }\n .total-row {\n border-top: 2px solid #1abc9c;\n padding-top: 12px;\n font-size: 16px;\n font-weight: 700;\n color: #2c3e50;\n }\n .total-amount-calc {\n color: #1abc9c;\n font-weight: 700;\n }\n \n /* Footer Section */\n .footer-section {\n margin-top: 120px;\n display: grid;\n grid-template-columns: 1fr 1fr 1fr;\n gap: 60px;\n align-items: end;\n }\n .thank-you {\n color: #1abc9c;\n font-size: 16px;\n font-style: italic;\n }\n .thank-you::before {\n content: 'π ';\n margin-right: 8px;\n }\n .contact-info {\n text-align: center;\n font-size: 11px;\n color: #95a5a6;\n line-height: 1.6;\n }\n .total-section {\n text-align: right;\n }\n .due-info {\n font-size: 11px;\n color: #7f8c8d;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin-bottom: 8px;\n }\n .due-date {\n font-size: 16px;\n font-weight: 600;\n color: #2c3e50;\n margin-bottom: 15px;\n }\n .account-number {\n font-size: 16px;\n color: #7f8c8d;\n margin-bottom: 15px;\n font-family: 'Courier New', monospace;\n }\n .total-amount {\n font-size: 2rem;\n font-weight: 700;\n color: #1abc9c;\n }\n \n @media print {\n body { -webkit-print-color-adjust: exact; color-adjust: exact; }\n .container { padding: 40px 20px; }\n }\n </style>\n</head>\n<body>\n <div class=\"container\">\n <!-- Header -->\n <div class=\"header\">\n <h1 class=\"invoice-title\">Invoice</h1>\n <div class=\"invoice-meta\">\n <p>Invoice number: <span class=\"invoice-number\">{{ $json.output.invoice_number.replace('INV-', '') }}</span></p>\n <p>Date: <strong>{{ $now.format('MMMM dd, yyyy') }}</strong></p>\n </div>\n </div>\n \n <!-- Company and Client Info -->\n <div class=\"info-section\">\n <div class=\"company-info\">\n <p><strong>Agentrix212</strong></p>\n <p>Digital Innovation Hub</p>\n <p>AI Automation Services</p>\n </div>\n <div class=\"client-info\">\n <div class=\"client-name\">{{ $json.output.client_name }}</div>\n <p>Professional Services</p>\n <p>{{ $json.output.client_email }}</p>\n </div>\n </div>\n \n <!-- Items Table -->\n <div class=\"items-section\">\n <div class=\"table-header\">\n <div>DESCRIPTION</div>\n <div style=\"text-align: center;\">PRICE</div>\n <div style=\"text-align: center;\">QUANTITY</div>\n <div style=\"text-align: right;\">SUBTOTAL</div>\n </div>\n \n {{ $json.output.items.map(item => `\n <div class=\"table-row\">\n <div class=\"item-description\">${item.description}</div>\n <div class=\"item-price\">${item.rate.toFixed(2)}</div>\n <div class=\"item-quantity\">${item.quantity}</div>\n <div class=\"item-subtotal\">${item.amount.toFixed(2)}</div>\n </div>\n `).join('') }}\n </div>\n \n <!-- Tax and Totals Calculation -->\n <div class=\"calculation-section\">\n <div class=\"totals-table\">\n <div class=\"totals-row subtotal-row\">\n <span>Subtotal:</span>\n <span>${{ $json.output.subtotal.toFixed(2) }}</span>\n </div>\n <div class=\"totals-row tax-row\">\n <span>Tax ({{ ($json.output.tax_rate * 1).toFixed(0) }}%):</span>\n <span>${{ $json.output.tax_amount.toFixed(2) }}</span>\n </div>\n <div class=\"totals-row total-row\">\n <span>Total:</span>\n <span class=\"total-amount-calc\">${{ $json.output.total.toFixed(2) }}</span>\n </div>\n </div>\n </div>\n \n <!-- Footer Section -->\n <div class=\"footer-section\">\n <div class=\"thank-you\">\n Thank you!\n </div>\n \n <div class=\"contact-info\">\n <p>support@agentrix212.com | agentrix212.com</p>\n </div>\n \n <div class=\"total-section\">\n <div class=\"due-info\">DUE BY</div>\n <div class=\"due-date\">{{ $json.output.due_date }}</div>\n \n <div class=\"due-info\">ACCOUNT NUMBER</div>\n <div class=\"account-number\">{{ Math.floor(Math.random() * 900000000000) + 100000000000 }}</div>\n \n <div class=\"due-info\">TOTAL DUE</div>\n <div class=\"total-amount\">${{ $json.output.total.toFixed(2) }}</div>\n </div>\n </div>\n </div>\n</body>\n</html>"
|
| 151 |
+
},
|
| 152 |
+
"id": "3827a323-cfcf-4d86-875d-f3aef6b641a0",
|
| 153 |
+
"name": "π¨ Generate HTML Template",
|
| 154 |
+
"type": "n8n-nodes-base.html",
|
| 155 |
+
"typeVersion": 1.2,
|
| 156 |
+
"position": [
|
| 157 |
+
380,
|
| 158 |
+
-100
|
| 159 |
+
]
|
| 160 |
+
},
|
| 161 |
+
{
|
| 162 |
+
"parameters": {
|
| 163 |
+
"operation": "sendDocument",
|
| 164 |
+
"chatId": "={{ $('π± Telegram Trigger').first().json.message.chat.id }}",
|
| 165 |
+
"file": "={{ $json.url }}",
|
| 166 |
+
"additionalFields": {
|
| 167 |
+
"parse_mode": "Markdown"
|
| 168 |
+
}
|
| 169 |
+
},
|
| 170 |
+
"id": "8665c5eb-43d7-4610-983d-e28fec7130bb",
|
| 171 |
+
"name": "π¨ Send Invoice PDF",
|
| 172 |
+
"type": "n8n-nodes-base.telegram",
|
| 173 |
+
"typeVersion": 1.2,
|
| 174 |
+
"position": [
|
| 175 |
+
1060,
|
| 176 |
+
-100
|
| 177 |
+
],
|
| 178 |
+
"webhookId": "b85226c8-0f1a-421f-94c4-c1bbcca191d6",
|
| 179 |
+
"credentials": {
|
| 180 |
+
"telegramApi": {
|
| 181 |
+
"id": "Cg9dM7bNcPpXNS5R",
|
| 182 |
+
"name": "Telegram account"
|
| 183 |
+
}
|
| 184 |
+
}
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"parameters": {
|
| 188 |
+
"model": "anthropic/claude-3.7-sonnet",
|
| 189 |
+
"options": {}
|
| 190 |
+
},
|
| 191 |
+
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
|
| 192 |
+
"typeVersion": 1,
|
| 193 |
+
"position": [
|
| 194 |
+
-180,
|
| 195 |
+
140
|
| 196 |
+
],
|
| 197 |
+
"id": "2c09df09-d72f-4e15-8589-51d39f8c6ead",
|
| 198 |
+
"name": "OpenRouter Chat Model",
|
| 199 |
+
"credentials": {
|
| 200 |
+
"openRouterApi": {
|
| 201 |
+
"id": "LX8VcZUBckotLjPE",
|
| 202 |
+
"name": "OpenRouter account"
|
| 203 |
+
}
|
| 204 |
+
}
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
"parameters": {
|
| 208 |
+
"chatId": "={{ $json.message.chat.id }}",
|
| 209 |
+
"text": "π€ **Welcome to AI Invoice Generator!**\n\nβ¨ **Just describe your invoice and I'll create a professional PDF instantly!**\n\nπ **Example messages:**\nβ’ \"Invoice for web design project, client John Doe, $2500, due in 30 days\"\nβ’ \"Bill Sarah for 5 hours consulting at $150/hour\"\nβ’ \"Create invoice: Logo design $800 for ABC Company\"\n\nπ **I'll automatically:**\nβ’ Extract all invoice details using AI\nβ’ Generate professional PDF with your branding\nβ’ Calculate taxes and totals\nβ’ Add invoice numbers and dates\n\nπ‘ **Just send me your invoice description to get started!**",
|
| 210 |
+
"additionalFields": {
|
| 211 |
+
"appendAttribution": false,
|
| 212 |
+
"parse_mode": "Markdown"
|
| 213 |
+
}
|
| 214 |
+
},
|
| 215 |
+
"id": "1d1c80c5-79e7-4e7e-b005-c54024cf09f6",
|
| 216 |
+
"name": "π Send Welcome",
|
| 217 |
+
"type": "n8n-nodes-base.telegram",
|
| 218 |
+
"typeVersion": 1.2,
|
| 219 |
+
"position": [
|
| 220 |
+
-460,
|
| 221 |
+
-180
|
| 222 |
+
],
|
| 223 |
+
"webhookId": "10194ec8-1350-46f3-b018-97f895bbcfda",
|
| 224 |
+
"credentials": {
|
| 225 |
+
"telegramApi": {
|
| 226 |
+
"id": "Cg9dM7bNcPpXNS5R",
|
| 227 |
+
"name": "Telegram account"
|
| 228 |
+
}
|
| 229 |
+
}
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"parameters": {
|
| 233 |
+
"content": "## Send invoice request\n",
|
| 234 |
+
"height": 340,
|
| 235 |
+
"width": 360
|
| 236 |
+
},
|
| 237 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 238 |
+
"position": [
|
| 239 |
+
-1200,
|
| 240 |
+
-160
|
| 241 |
+
],
|
| 242 |
+
"typeVersion": 1,
|
| 243 |
+
"id": "9739fddd-fa2c-4a02-8f56-de2a22caf3c3",
|
| 244 |
+
"name": "Sticky Note"
|
| 245 |
+
},
|
| 246 |
+
{
|
| 247 |
+
"parameters": {
|
| 248 |
+
"content": "## Generate Invoice Data",
|
| 249 |
+
"height": 540,
|
| 250 |
+
"width": 460,
|
| 251 |
+
"color": 4
|
| 252 |
+
},
|
| 253 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 254 |
+
"position": [
|
| 255 |
+
-220,
|
| 256 |
+
-220
|
| 257 |
+
],
|
| 258 |
+
"typeVersion": 1,
|
| 259 |
+
"id": "dbf52616-4ae9-449e-9ab6-bc71a6ade35f",
|
| 260 |
+
"name": "Sticky Note1"
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"parameters": {
|
| 264 |
+
"content": "## Generate Invoice HTML Format\n ",
|
| 265 |
+
"height": 280,
|
| 266 |
+
"width": 300,
|
| 267 |
+
"color": 5
|
| 268 |
+
},
|
| 269 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 270 |
+
"position": [
|
| 271 |
+
280,
|
| 272 |
+
-180
|
| 273 |
+
],
|
| 274 |
+
"typeVersion": 1,
|
| 275 |
+
"id": "02df6326-2241-4838-9185-f04c94148ec9",
|
| 276 |
+
"name": "Sticky Note2"
|
| 277 |
+
},
|
| 278 |
+
{
|
| 279 |
+
"parameters": {
|
| 280 |
+
"content": "## Convert to PDF \n ",
|
| 281 |
+
"height": 280,
|
| 282 |
+
"width": 300,
|
| 283 |
+
"color": 2
|
| 284 |
+
},
|
| 285 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 286 |
+
"position": [
|
| 287 |
+
620,
|
| 288 |
+
-180
|
| 289 |
+
],
|
| 290 |
+
"typeVersion": 1,
|
| 291 |
+
"id": "b1e689da-6b65-4296-9620-d7c8fa92fb23",
|
| 292 |
+
"name": "Sticky Note3"
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"parameters": {
|
| 296 |
+
"operation": "URL/HTML to PDF",
|
| 297 |
+
"convertType": "htmlToPDF",
|
| 298 |
+
"html": "={{ $json.html }}",
|
| 299 |
+
"advancedOptions": {
|
| 300 |
+
"name": "Invoice",
|
| 301 |
+
"paperSize": "a3"
|
| 302 |
+
}
|
| 303 |
+
},
|
| 304 |
+
"type": "n8n-nodes-pdfco.PDFco Api",
|
| 305 |
+
"typeVersion": 1,
|
| 306 |
+
"position": [
|
| 307 |
+
700,
|
| 308 |
+
-100
|
| 309 |
+
],
|
| 310 |
+
"id": "cb126785-4830-40f3-a37e-b709dbe26945",
|
| 311 |
+
"name": "PDFco Api",
|
| 312 |
+
"credentials": {
|
| 313 |
+
"pdfcoApi": {
|
| 314 |
+
"id": "sLpw8eZPwE9wevn6",
|
| 315 |
+
"name": "PDF.co account"
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
"parameters": {
|
| 321 |
+
"content": "## Return Invoice PDF \n ",
|
| 322 |
+
"height": 280,
|
| 323 |
+
"width": 300,
|
| 324 |
+
"color": 6
|
| 325 |
+
},
|
| 326 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 327 |
+
"position": [
|
| 328 |
+
960,
|
| 329 |
+
-180
|
| 330 |
+
],
|
| 331 |
+
"typeVersion": 1,
|
| 332 |
+
"id": "70a3a259-9d15-42d7-a90d-cf65ab5653ab",
|
| 333 |
+
"name": "Sticky Note4"
|
| 334 |
+
}
|
| 335 |
+
],
|
| 336 |
+
"pinData": {},
|
| 337 |
+
"connections": {
|
| 338 |
+
"π± Telegram Trigger": {
|
| 339 |
+
"main": [
|
| 340 |
+
[
|
| 341 |
+
{
|
| 342 |
+
"node": "π Route Messages",
|
| 343 |
+
"type": "main",
|
| 344 |
+
"index": 0
|
| 345 |
+
}
|
| 346 |
+
]
|
| 347 |
+
]
|
| 348 |
+
},
|
| 349 |
+
"π Route Messages": {
|
| 350 |
+
"main": [
|
| 351 |
+
[
|
| 352 |
+
{
|
| 353 |
+
"node": "π Send Welcome",
|
| 354 |
+
"type": "main",
|
| 355 |
+
"index": 0
|
| 356 |
+
}
|
| 357 |
+
],
|
| 358 |
+
[
|
| 359 |
+
{
|
| 360 |
+
"node": "β‘ Processing Message",
|
| 361 |
+
"type": "main",
|
| 362 |
+
"index": 0
|
| 363 |
+
}
|
| 364 |
+
]
|
| 365 |
+
]
|
| 366 |
+
},
|
| 367 |
+
"β‘ Processing Message": {
|
| 368 |
+
"main": [
|
| 369 |
+
[
|
| 370 |
+
{
|
| 371 |
+
"node": "π§ AI Invoice Agent",
|
| 372 |
+
"type": "main",
|
| 373 |
+
"index": 0
|
| 374 |
+
}
|
| 375 |
+
]
|
| 376 |
+
]
|
| 377 |
+
},
|
| 378 |
+
"π Extract Invoice Data": {
|
| 379 |
+
"ai_outputParser": [
|
| 380 |
+
[
|
| 381 |
+
{
|
| 382 |
+
"node": "π§ AI Invoice Agent",
|
| 383 |
+
"type": "ai_outputParser",
|
| 384 |
+
"index": 0
|
| 385 |
+
}
|
| 386 |
+
]
|
| 387 |
+
]
|
| 388 |
+
},
|
| 389 |
+
"π¨ Generate HTML Template": {
|
| 390 |
+
"main": [
|
| 391 |
+
[
|
| 392 |
+
{
|
| 393 |
+
"node": "PDFco Api",
|
| 394 |
+
"type": "main",
|
| 395 |
+
"index": 0
|
| 396 |
+
}
|
| 397 |
+
]
|
| 398 |
+
]
|
| 399 |
+
},
|
| 400 |
+
"π§ AI Invoice Agent": {
|
| 401 |
+
"main": [
|
| 402 |
+
[
|
| 403 |
+
{
|
| 404 |
+
"node": "π¨ Generate HTML Template",
|
| 405 |
+
"type": "main",
|
| 406 |
+
"index": 0
|
| 407 |
+
}
|
| 408 |
+
]
|
| 409 |
+
]
|
| 410 |
+
},
|
| 411 |
+
"OpenRouter Chat Model": {
|
| 412 |
+
"ai_languageModel": [
|
| 413 |
+
[
|
| 414 |
+
{
|
| 415 |
+
"node": "π§ AI Invoice Agent",
|
| 416 |
+
"type": "ai_languageModel",
|
| 417 |
+
"index": 0
|
| 418 |
+
}
|
| 419 |
+
]
|
| 420 |
+
]
|
| 421 |
+
},
|
| 422 |
+
"π¨ Send Invoice PDF": {
|
| 423 |
+
"main": [
|
| 424 |
+
[]
|
| 425 |
+
]
|
| 426 |
+
},
|
| 427 |
+
"PDFco Api": {
|
| 428 |
+
"main": [
|
| 429 |
+
[
|
| 430 |
+
{
|
| 431 |
+
"node": "π¨ Send Invoice PDF",
|
| 432 |
+
"type": "main",
|
| 433 |
+
"index": 0
|
| 434 |
+
}
|
| 435 |
+
]
|
| 436 |
+
]
|
| 437 |
+
}
|
| 438 |
+
},
|
| 439 |
+
"active": false,
|
| 440 |
+
"settings": {
|
| 441 |
+
"executionOrder": "v1"
|
| 442 |
+
},
|
| 443 |
+
"versionId": "0e9a3f76-88de-4bed-b47a-d2adea25057a",
|
| 444 |
+
"meta": {
|
| 445 |
+
"templateCredsSetupCompleted": true,
|
| 446 |
+
"instanceId": "cc8fbc6c0e10ac107523cabe2453f0b9216ff0ef0c1f112312039de381e2f175"
|
| 447 |
+
},
|
| 448 |
+
"id": "1dxqBWPyjMuKadnw",
|
| 449 |
+
"tags": []
|
| 450 |
+
}
|