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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "Invoice_Extractor",
3
+ "nodes": [
4
+ {
5
+ "parameters": {
6
+ "pollTimes": {
7
+ "item": [
8
+ {
9
+ "mode": "everyMinute"
10
+ }
11
+ ]
12
+ },
13
+ "triggerOn": "specificFolder",
14
+ "folderToWatch": {
15
+ "__rl": true,
16
+ "value": "1rE6I5oWbzqVu6OgrV-lo6VYkNorLZwra",
17
+ "mode": "list",
18
+ "cachedResultName": "Invoices ",
19
+ "cachedResultUrl": "https://drive.google.com/drive/folders/1rE6I5oWbzqVu6OgrV-lo6VYkNorLZwra"
20
+ },
21
+ "event": "fileCreated",
22
+ "options": {}
23
+ },
24
+ "id": "70a78566-15e7-4fbc-a426-c36a6094b845",
25
+ "name": "πŸ“ Drive File Monitor",
26
+ "type": "n8n-nodes-base.googleDriveTrigger",
27
+ "typeVersion": 1,
28
+ "position": [
29
+ 1560,
30
+ 760
31
+ ],
32
+ "credentials": {
33
+ "googleDriveOAuth2Api": {
34
+ "id": "a0H1R45zFS4MeKDk",
35
+ "name": "Google Drive account"
36
+ }
37
+ }
38
+ },
39
+ {
40
+ "parameters": {
41
+ "operation": "download",
42
+ "fileId": {
43
+ "__rl": true,
44
+ "value": "={{ $json.id }}",
45
+ "mode": "id"
46
+ },
47
+ "options": {}
48
+ },
49
+ "id": "bc33a79b-bf50-4e6e-9352-2780e36381b0",
50
+ "name": "⬇️ Download File",
51
+ "type": "n8n-nodes-base.googleDrive",
52
+ "typeVersion": 3,
53
+ "position": [
54
+ 1760,
55
+ 760
56
+ ],
57
+ "credentials": {
58
+ "googleDriveOAuth2Api": {
59
+ "id": "a0H1R45zFS4MeKDk",
60
+ "name": "Google Drive account"
61
+ }
62
+ }
63
+ },
64
+ {
65
+ "parameters": {
66
+ "rules": {
67
+ "values": [
68
+ {
69
+ "conditions": {
70
+ "options": {
71
+ "caseSensitive": true,
72
+ "leftValue": "",
73
+ "typeValidation": "strict",
74
+ "version": 1
75
+ },
76
+ "conditions": [
77
+ {
78
+ "id": "pdf-check",
79
+ "leftValue": "={{ $('πŸ“ Drive File Monitor').item.json.mimeType }}",
80
+ "rightValue": "application/pdf",
81
+ "operator": {
82
+ "type": "string",
83
+ "operation": "equals"
84
+ }
85
+ }
86
+ ],
87
+ "combinator": "and"
88
+ }
89
+ },
90
+ {
91
+ "conditions": {
92
+ "options": {
93
+ "caseSensitive": true,
94
+ "leftValue": "",
95
+ "typeValidation": "strict",
96
+ "version": 1
97
+ },
98
+ "conditions": [
99
+ {
100
+ "id": "image-check",
101
+ "leftValue": "={{ $('πŸ“ Drive File Monitor').item.json.mimeType }}",
102
+ "rightValue": "image/",
103
+ "operator": {
104
+ "type": "string",
105
+ "operation": "startsWith"
106
+ }
107
+ }
108
+ ],
109
+ "combinator": "and"
110
+ }
111
+ }
112
+ ]
113
+ },
114
+ "options": {}
115
+ },
116
+ "id": "4a200151-aa83-4c99-8717-7b5565f2f88b",
117
+ "name": "πŸ“‚ File Type Router",
118
+ "type": "n8n-nodes-base.switch",
119
+ "typeVersion": 3,
120
+ "position": [
121
+ 2080,
122
+ 760
123
+ ]
124
+ },
125
+ {
126
+ "parameters": {
127
+ "operation": "pdf",
128
+ "options": {}
129
+ },
130
+ "id": "7d882cf8-f699-441d-bbde-114ac83efe93",
131
+ "name": "πŸ“„ PDF Text Extractor",
132
+ "type": "n8n-nodes-base.extractFromFile",
133
+ "typeVersion": 1,
134
+ "position": [
135
+ 2400,
136
+ 600
137
+ ]
138
+ },
139
+ {
140
+ "parameters": {
141
+ "resource": "image",
142
+ "operation": "analyze",
143
+ "modelId": {
144
+ "__rl": true,
145
+ "mode": "list",
146
+ "value": "gpt-4o"
147
+ },
148
+ "inputType": "base64",
149
+ "options": {}
150
+ },
151
+ "id": "bc840d16-b1e1-43f1-b2ab-b07c54571997",
152
+ "name": "πŸ–ΌοΈ OpenAI Image OCR",
153
+ "type": "@n8n/n8n-nodes-langchain.openAi",
154
+ "typeVersion": 1.8,
155
+ "position": [
156
+ 2420,
157
+ 940
158
+ ],
159
+ "credentials": {
160
+ "openAiApi": {
161
+ "id": "jJ43azhw4WsPfIMK",
162
+ "name": "OpenAi account"
163
+ }
164
+ }
165
+ },
166
+ {
167
+ "parameters": {
168
+ "assignments": {
169
+ "assignments": [
170
+ {
171
+ "id": "file-info",
172
+ "name": "file_name",
173
+ "value": "={{ $('πŸ“ Drive File Monitor').item.json.name }}",
174
+ "type": "string"
175
+ },
176
+ {
177
+ "id": "file-size",
178
+ "name": "file_size",
179
+ "value": "={{ $('πŸ“ Drive File Monitor').item.json.size }}",
180
+ "type": "number"
181
+ },
182
+ {
183
+ "id": "content-type",
184
+ "name": "content_type",
185
+ "value": "pdf_text",
186
+ "type": "string"
187
+ },
188
+ {
189
+ "id": "document-content",
190
+ "name": "document_content",
191
+ "value": "={{ $json.text }}",
192
+ "type": "string"
193
+ },
194
+ {
195
+ "id": "processing-timestamp",
196
+ "name": "processing_timestamp",
197
+ "value": "={{ new Date().toISOString() }}",
198
+ "type": "string"
199
+ }
200
+ ]
201
+ },
202
+ "options": {}
203
+ },
204
+ "id": "a59f731f-349b-49cf-a322-cfc6302241ce",
205
+ "name": "πŸ“ Prepare PDF Data",
206
+ "type": "n8n-nodes-base.set",
207
+ "typeVersion": 3.4,
208
+ "position": [
209
+ 2680,
210
+ 600
211
+ ]
212
+ },
213
+ {
214
+ "parameters": {
215
+ "assignments": {
216
+ "assignments": [
217
+ {
218
+ "id": "file-info",
219
+ "name": "file_name",
220
+ "value": "={{ $('πŸ“ Drive File Monitor').item.json.name }}",
221
+ "type": "string"
222
+ },
223
+ {
224
+ "id": "file-size",
225
+ "name": "file_size",
226
+ "value": "={{ $('πŸ“ Drive File Monitor').item.json.size }}",
227
+ "type": "number"
228
+ },
229
+ {
230
+ "id": "content-type",
231
+ "name": "content_type",
232
+ "value": "image_text",
233
+ "type": "string"
234
+ },
235
+ {
236
+ "id": "document-content",
237
+ "name": "document_content",
238
+ "value": "={{ $json.content }}",
239
+ "type": "string"
240
+ },
241
+ {
242
+ "id": "processing-timestamp",
243
+ "name": "processing_timestamp",
244
+ "value": "={{ new Date().toISOString() }}",
245
+ "type": "string"
246
+ }
247
+ ]
248
+ },
249
+ "options": {}
250
+ },
251
+ "id": "7565b1fe-2dab-484d-9cea-6434c7b3bb8d",
252
+ "name": "πŸ–ΌοΈ Prepare Image Data",
253
+ "type": "n8n-nodes-base.set",
254
+ "typeVersion": 3.4,
255
+ "position": [
256
+ 2680,
257
+ 940
258
+ ]
259
+ },
260
+ {
261
+ "parameters": {},
262
+ "id": "e1a1448f-cdb9-45a7-b90e-bba69b85776e",
263
+ "name": "πŸ”„ Merge Content",
264
+ "type": "n8n-nodes-base.merge",
265
+ "typeVersion": 3,
266
+ "position": [
267
+ 2940,
268
+ 760
269
+ ]
270
+ },
271
+ {
272
+ "parameters": {
273
+ "promptType": "define",
274
+ "text": "=πŸ“„ INVOICE DATA EXTRACTION TASK\n\nπŸ“‹ **File Information:**\n- File Name: {{ $json.file_name }}\n- Content Type: {{ $json.content_type }}\n- File Size: {{ Math.round($json.file_size / 1024) }}KB\n- Processing Time: {{ $json.processing_timestamp }}\n\nπŸ“ **Document Content to Analyze:**\n{{ $json.document_content }}\n\n🎯 **TASK:** Extract ALL invoice data from the above content and return structured JSON with complete information for business accounting purposes.",
275
+ "hasOutputParser": true,
276
+ "options": {
277
+ "systemMessage": "You are InvoiceExtractorAI, a specialized enterprise-grade invoice processing system.\n\n🎯 **PRIMARY FUNCTION:** Extract structured invoice data from text content (from PDFs or OCR'd images).\n\nπŸ“Š **EXTRACTION REQUIREMENTS:**\nExtract ALL available information including:\n1. **Vendor Information** - Company name, address, phone, email, tax ID\n2. **Document Details** - Invoice number, date, due date, PO number, currency\n3. **Financial Data** - Subtotal, tax amount, total amount, payment terms\n4. **Customer Information** - Billing name and address\n5. **Line Items** - Description, quantity, unit price, line total for each item\n6. **Additional Data** - Notes, terms, shipping info\n\nπŸ” **PROCESSING INSTRUCTIONS:**\n- Parse amounts as clean numbers (remove currency symbols)\n- Convert dates to YYYY-MM-DD format\n- Handle multiple currencies and languages\n- Calculate and verify mathematical accuracy\n- Provide confidence scores for data quality\n- Flag any missing critical information\n\nπŸ“€ **OUTPUT FORMAT:** Return only valid JSON with complete structured data ready for immediate business use."
278
+ }
279
+ },
280
+ "id": "4bdf9334-87c6-48a8-a2c5-d6e9edd96e3a",
281
+ "name": "πŸ€– AI Invoice Agent",
282
+ "type": "@n8n/n8n-nodes-langchain.agent",
283
+ "typeVersion": 1.9,
284
+ "position": [
285
+ 3280,
286
+ 760
287
+ ]
288
+ },
289
+ {
290
+ "parameters": {
291
+ "operation": "append",
292
+ "documentId": {
293
+ "__rl": true,
294
+ "value": "1XNlywMQbwDE-o5wub4dqBqR30MCks0D5Zr-7AOTd9GI",
295
+ "mode": "list",
296
+ "cachedResultName": "Invoice_Extractions_data",
297
+ "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1XNlywMQbwDE-o5wub4dqBqR30MCks0D5Zr-7AOTd9GI/edit?usp=drivesdk"
298
+ },
299
+ "sheetName": {
300
+ "__rl": true,
301
+ "value": "gid=0",
302
+ "mode": "list",
303
+ "cachedResultName": "Invoices",
304
+ "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1XNlywMQbwDE-o5wub4dqBqR30MCks0D5Zr-7AOTd9GI/edit#gid=0"
305
+ },
306
+ "columns": {
307
+ "mappingMode": "defineBelow",
308
+ "value": {
309
+ "Processing_ID": "={{ $json.output.processing_info?.processing_id || 'PROC_' + Date.now() }}",
310
+ "Processing_Date": "={{ $json.output.processing_info?.processing_timestamp || new Date().toISOString() }}",
311
+ "File_Name": "={{ $('πŸ”„ Merge Content').item.json.file_name }}",
312
+ "Content_Type": "={{ $('πŸ”„ Merge Content').item.json.content_type }}",
313
+ "Invoice_Number": "={{ $json.output.document_details?.invoice_number }}",
314
+ "Invoice_Date": "={{ $json.output.document_details?.invoice_date }}",
315
+ "Due_Date": "={{ $json.output.document_details?.due_date }}",
316
+ "Vendor_Name": "={{ $json.output.vendor_information?.company_name }}",
317
+ "Vendor_Email": "={{ $json.output.vendor_information?.email }}",
318
+ "Vendor_Phone": "={{ $json.output.vendor_information?.phone }}",
319
+ "Currency": "={{ $json.output.document_details?.currency }}",
320
+ "Subtotal": "={{ $json.output.financial_summary?.subtotal }}",
321
+ "Tax_Amount": "={{ $json.output.financial_summary?.tax_amount }}",
322
+ "Total_Amount": "={{ $json.output.financial_summary?.total_amount }}",
323
+ "Customer_Name": "={{ $json.output.customer_information?.customer_name }}",
324
+ "Confidence_Score": "={{ $json.output.processing_info?.confidence_score }}",
325
+ "Data_Completeness": "={{ $json.output.processing_info?.data_completeness }}",
326
+ "Payment_Terms": "={{ $json.output.document_details?.payment_terms }}",
327
+ "Line_Items_Count": "={{ ($json.output.line_items || []).length }}",
328
+ "Status": "processed",
329
+ "Needs_Review": "={{ ($json.output.processing_info?.confidence_score || 0) < 0.8 ? 'Yes' : 'No' }}\n"
330
+ },
331
+ "matchingColumns": [],
332
+ "schema": [
333
+ {
334
+ "id": "Processing_ID",
335
+ "displayName": "Processing_ID",
336
+ "required": false,
337
+ "defaultMatch": false,
338
+ "display": true,
339
+ "type": "string",
340
+ "canBeUsedToMatch": true
341
+ },
342
+ {
343
+ "id": "Processing_Date",
344
+ "displayName": "Processing_Date",
345
+ "required": false,
346
+ "defaultMatch": false,
347
+ "display": true,
348
+ "type": "string",
349
+ "canBeUsedToMatch": true
350
+ },
351
+ {
352
+ "id": "File_Name",
353
+ "displayName": "File_Name",
354
+ "required": false,
355
+ "defaultMatch": false,
356
+ "display": true,
357
+ "type": "string",
358
+ "canBeUsedToMatch": true
359
+ },
360
+ {
361
+ "id": "Content_Type",
362
+ "displayName": "Content_Type",
363
+ "required": false,
364
+ "defaultMatch": false,
365
+ "display": true,
366
+ "type": "string",
367
+ "canBeUsedToMatch": true
368
+ },
369
+ {
370
+ "id": "Invoice_Number",
371
+ "displayName": "Invoice_Number",
372
+ "required": false,
373
+ "defaultMatch": false,
374
+ "display": true,
375
+ "type": "string",
376
+ "canBeUsedToMatch": true
377
+ },
378
+ {
379
+ "id": "Invoice_Date",
380
+ "displayName": "Invoice_Date",
381
+ "required": false,
382
+ "defaultMatch": false,
383
+ "display": true,
384
+ "type": "string",
385
+ "canBeUsedToMatch": true
386
+ },
387
+ {
388
+ "id": "Due_Date",
389
+ "displayName": "Due_Date",
390
+ "required": false,
391
+ "defaultMatch": false,
392
+ "display": true,
393
+ "type": "string",
394
+ "canBeUsedToMatch": true
395
+ },
396
+ {
397
+ "id": "Vendor_Name",
398
+ "displayName": "Vendor_Name",
399
+ "required": false,
400
+ "defaultMatch": false,
401
+ "display": true,
402
+ "type": "string",
403
+ "canBeUsedToMatch": true
404
+ },
405
+ {
406
+ "id": "Vendor_Email",
407
+ "displayName": "Vendor_Email",
408
+ "required": false,
409
+ "defaultMatch": false,
410
+ "display": true,
411
+ "type": "string",
412
+ "canBeUsedToMatch": true
413
+ },
414
+ {
415
+ "id": "Vendor_Phone",
416
+ "displayName": "Vendor_Phone",
417
+ "required": false,
418
+ "defaultMatch": false,
419
+ "display": true,
420
+ "type": "string",
421
+ "canBeUsedToMatch": true
422
+ },
423
+ {
424
+ "id": "Currency",
425
+ "displayName": "Currency",
426
+ "required": false,
427
+ "defaultMatch": false,
428
+ "display": true,
429
+ "type": "string",
430
+ "canBeUsedToMatch": true
431
+ },
432
+ {
433
+ "id": "Subtotal",
434
+ "displayName": "Subtotal",
435
+ "required": false,
436
+ "defaultMatch": false,
437
+ "display": true,
438
+ "type": "string",
439
+ "canBeUsedToMatch": true
440
+ },
441
+ {
442
+ "id": "Tax_Amount",
443
+ "displayName": "Tax_Amount",
444
+ "required": false,
445
+ "defaultMatch": false,
446
+ "display": true,
447
+ "type": "string",
448
+ "canBeUsedToMatch": true
449
+ },
450
+ {
451
+ "id": "Total_Amount",
452
+ "displayName": "Total_Amount",
453
+ "required": false,
454
+ "defaultMatch": false,
455
+ "display": true,
456
+ "type": "string",
457
+ "canBeUsedToMatch": true
458
+ },
459
+ {
460
+ "id": "Customer_Name",
461
+ "displayName": "Customer_Name",
462
+ "required": false,
463
+ "defaultMatch": false,
464
+ "display": true,
465
+ "type": "string",
466
+ "canBeUsedToMatch": true
467
+ },
468
+ {
469
+ "id": "Confidence_Score",
470
+ "displayName": "Confidence_Score",
471
+ "required": false,
472
+ "defaultMatch": false,
473
+ "display": true,
474
+ "type": "string",
475
+ "canBeUsedToMatch": true
476
+ },
477
+ {
478
+ "id": "Data_Completeness",
479
+ "displayName": "Data_Completeness",
480
+ "required": false,
481
+ "defaultMatch": false,
482
+ "display": true,
483
+ "type": "string",
484
+ "canBeUsedToMatch": true,
485
+ "removed": false
486
+ },
487
+ {
488
+ "id": "Payment_Terms",
489
+ "displayName": "Payment_Terms",
490
+ "required": false,
491
+ "defaultMatch": false,
492
+ "display": true,
493
+ "type": "string",
494
+ "canBeUsedToMatch": true
495
+ },
496
+ {
497
+ "id": "Line_Items_Count",
498
+ "displayName": "Line_Items_Count",
499
+ "required": false,
500
+ "defaultMatch": false,
501
+ "display": true,
502
+ "type": "string",
503
+ "canBeUsedToMatch": true
504
+ },
505
+ {
506
+ "id": "Status",
507
+ "displayName": "Status",
508
+ "required": false,
509
+ "defaultMatch": false,
510
+ "display": true,
511
+ "type": "string",
512
+ "canBeUsedToMatch": true
513
+ },
514
+ {
515
+ "id": "Needs_Review",
516
+ "displayName": "Needs_Review",
517
+ "required": false,
518
+ "defaultMatch": false,
519
+ "display": true,
520
+ "type": "string",
521
+ "canBeUsedToMatch": true
522
+ }
523
+ ],
524
+ "attemptToConvertTypes": false,
525
+ "convertFieldsToString": false
526
+ },
527
+ "options": {}
528
+ },
529
+ "id": "0415bca2-c939-45d4-b936-4e6637ceaa0a",
530
+ "name": "πŸ’Ύ Store Invoice Data",
531
+ "type": "n8n-nodes-base.googleSheets",
532
+ "typeVersion": 4.5,
533
+ "position": [
534
+ 4100,
535
+ 600
536
+ ],
537
+ "credentials": {
538
+ "googleSheetsOAuth2Api": {
539
+ "id": "03CEMaGPaZ8zhwpp",
540
+ "name": "Google Sheets account"
541
+ }
542
+ }
543
+ },
544
+ {
545
+ "parameters": {
546
+ "operation": "appendOrUpdate",
547
+ "documentId": {
548
+ "__rl": true,
549
+ "value": "1XNlywMQbwDE-o5wub4dqBqR30MCks0D5Zr-7AOTd9GI",
550
+ "mode": "list",
551
+ "cachedResultName": "Invoice_Extractions_data",
552
+ "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1XNlywMQbwDE-o5wub4dqBqR30MCks0D5Zr-7AOTd9GI/edit?usp=drivesdk"
553
+ },
554
+ "sheetName": {
555
+ "__rl": true,
556
+ "value": 492793613,
557
+ "mode": "list",
558
+ "cachedResultName": "Vendors",
559
+ "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1XNlywMQbwDE-o5wub4dqBqR30MCks0D5Zr-7AOTd9GI/edit#gid=492793613"
560
+ },
561
+ "columns": {
562
+ "mappingMode": "defineBelow",
563
+ "value": {
564
+ "Vendor_Name": "={{ $json.output.vendor_information?.company_name }}",
565
+ "Tax_ID": "={{ $json.output.vendor_information?.tax_id }}",
566
+ "Vendor_Phone": "={{ $json.output.vendor_information?.phone }}",
567
+ "Vendor_Address": "={{ $json.output.vendor_information?.address }}",
568
+ "Vendor_Email": "={{ $json.output.vendor_information?.email }}",
569
+ "Website": "={{ $json.output.vendor_information?.website }}",
570
+ "Last_Invoice_Date": "={{ $json.output.document_details?.invoice_date }}",
571
+ "Last_Amount": "={{ $json.output.financial_summary?.total_amount }}",
572
+ "Currency": "={{ $json.output.document_details?.currency }}",
573
+ "Last_Updated": "={{ $json.output.processing_info?.processing_timestamp || new Date().toISOString() }}"
574
+ },
575
+ "matchingColumns": [
576
+ "Vendor_Name"
577
+ ],
578
+ "schema": [
579
+ {
580
+ "id": "Vendor_Name",
581
+ "displayName": "Vendor_Name",
582
+ "required": false,
583
+ "defaultMatch": false,
584
+ "display": true,
585
+ "type": "string",
586
+ "canBeUsedToMatch": true,
587
+ "removed": false
588
+ },
589
+ {
590
+ "id": "Vendor_Email",
591
+ "displayName": "Vendor_Email",
592
+ "required": false,
593
+ "defaultMatch": false,
594
+ "display": true,
595
+ "type": "string",
596
+ "canBeUsedToMatch": true,
597
+ "removed": false
598
+ },
599
+ {
600
+ "id": "Vendor_Phone",
601
+ "displayName": "Vendor_Phone",
602
+ "required": false,
603
+ "defaultMatch": false,
604
+ "display": true,
605
+ "type": "string",
606
+ "canBeUsedToMatch": true
607
+ },
608
+ {
609
+ "id": "Vendor_Address",
610
+ "displayName": "Vendor_Address",
611
+ "required": false,
612
+ "defaultMatch": false,
613
+ "display": true,
614
+ "type": "string",
615
+ "canBeUsedToMatch": true
616
+ },
617
+ {
618
+ "id": "Tax_ID",
619
+ "displayName": "Tax_ID",
620
+ "required": false,
621
+ "defaultMatch": false,
622
+ "display": true,
623
+ "type": "string",
624
+ "canBeUsedToMatch": true,
625
+ "removed": false
626
+ },
627
+ {
628
+ "id": "Website",
629
+ "displayName": "Website",
630
+ "required": false,
631
+ "defaultMatch": false,
632
+ "display": true,
633
+ "type": "string",
634
+ "canBeUsedToMatch": true
635
+ },
636
+ {
637
+ "id": "Last_Invoice_Date",
638
+ "displayName": "Last_Invoice_Date",
639
+ "required": false,
640
+ "defaultMatch": false,
641
+ "display": true,
642
+ "type": "string",
643
+ "canBeUsedToMatch": true
644
+ },
645
+ {
646
+ "id": "Last_Amount",
647
+ "displayName": "Last_Amount",
648
+ "required": false,
649
+ "defaultMatch": false,
650
+ "display": true,
651
+ "type": "string",
652
+ "canBeUsedToMatch": true
653
+ },
654
+ {
655
+ "id": "Currency",
656
+ "displayName": "Currency",
657
+ "required": false,
658
+ "defaultMatch": false,
659
+ "display": true,
660
+ "type": "string",
661
+ "canBeUsedToMatch": true
662
+ },
663
+ {
664
+ "id": "Last_Updated",
665
+ "displayName": "Last_Updated",
666
+ "required": false,
667
+ "defaultMatch": false,
668
+ "display": true,
669
+ "type": "string",
670
+ "canBeUsedToMatch": true,
671
+ "removed": false
672
+ }
673
+ ],
674
+ "attemptToConvertTypes": false,
675
+ "convertFieldsToString": false
676
+ },
677
+ "options": {}
678
+ },
679
+ "id": "b90d6758-463a-4d7e-b75c-b348fdda3059",
680
+ "name": "🏒 Update Vendor Database",
681
+ "type": "n8n-nodes-base.googleSheets",
682
+ "typeVersion": 4.5,
683
+ "position": [
684
+ 4120,
685
+ 1020
686
+ ],
687
+ "credentials": {
688
+ "googleSheetsOAuth2Api": {
689
+ "id": "03CEMaGPaZ8zhwpp",
690
+ "name": "Google Sheets account"
691
+ }
692
+ }
693
+ },
694
+ {
695
+ "parameters": {
696
+ "chatId": "1232923238",
697
+ "text": "=πŸš€ **Invoice Processed Successfully!**\n\nπŸ“„ **{{ $('πŸ”„ Merge Content').item.json.file_name }}**\n🏒 **{{ $json.output.vendor_information?.company_name || 'Vendor not detected' }}**\nπŸ’° **{{ $json.output.document_details?.currency || '$' }} {{ $json.output.financial_summary?.total_amount || 'N/A' }}**\nπŸ“… **{{ $json.output.document_details?.invoice_date || 'Date not detected' }}**\n\nβœ… **High Quality** β€’ {{ Math.round(($json.output.processing_info?.confidence_score || 0) * 100) }}% confidence\n\nπŸ’Ύ Stored in Google Sheets",
698
+ "additionalFields": {
699
+ "parse_mode": "Markdown"
700
+ }
701
+ },
702
+ "id": "f4ccd81e-b079-43a0-bb2a-eeb867ad0abf",
703
+ "name": "πŸ“± Telegram Notification",
704
+ "type": "n8n-nodes-base.telegram",
705
+ "typeVersion": 1.2,
706
+ "position": [
707
+ 4120,
708
+ 820
709
+ ],
710
+ "webhookId": "c35d04b1-3fd2-44f6-b5a6-bbd19a89bead",
711
+ "credentials": {
712
+ "telegramApi": {
713
+ "id": "Cg9dM7bNcPpXNS5R",
714
+ "name": "Telegram account"
715
+ }
716
+ }
717
+ },
718
+ {
719
+ "parameters": {},
720
+ "type": "@n8n/n8n-nodes-langchain.toolThink",
721
+ "typeVersion": 1,
722
+ "position": [
723
+ 3500,
724
+ 980
725
+ ],
726
+ "id": "6589dcfa-9701-45d4-9648-bad5fa3e69c8",
727
+ "name": "Think"
728
+ },
729
+ {
730
+ "parameters": {
731
+ "content": "## File Monitor and Download\n",
732
+ "height": 420,
733
+ "width": 400
734
+ },
735
+ "type": "n8n-nodes-base.stickyNote",
736
+ "position": [
737
+ 1500,
738
+ 620
739
+ ],
740
+ "typeVersion": 1,
741
+ "id": "0cf25a07-4c04-4f2f-95d5-d6ab9eba5407",
742
+ "name": "Sticky Note"
743
+ },
744
+ {
745
+ "parameters": {
746
+ "content": "## Routing : Document or image",
747
+ "height": 360,
748
+ "width": 340,
749
+ "color": 3
750
+ },
751
+ "type": "n8n-nodes-base.stickyNote",
752
+ "position": [
753
+ 1960,
754
+ 640
755
+ ],
756
+ "typeVersion": 1,
757
+ "id": "e8d3308f-be67-4065-915e-2fedd52c8567",
758
+ "name": "Sticky Note1"
759
+ },
760
+ {
761
+ "parameters": {
762
+ "content": "## Analyse and extract image content ",
763
+ "height": 280,
764
+ "width": 520,
765
+ "color": 6
766
+ },
767
+ "type": "n8n-nodes-base.stickyNote",
768
+ "position": [
769
+ 2340,
770
+ 860
771
+ ],
772
+ "typeVersion": 1,
773
+ "id": "8d62a09c-5fa7-4537-ad69-49de1374292e",
774
+ "name": "Sticky Note2"
775
+ },
776
+ {
777
+ "parameters": {
778
+ "content": "## Analyse and extract Docuemnt content ",
779
+ "height": 280,
780
+ "width": 520,
781
+ "color": 6
782
+ },
783
+ "type": "n8n-nodes-base.stickyNote",
784
+ "position": [
785
+ 2340,
786
+ 520
787
+ ],
788
+ "typeVersion": 1,
789
+ "id": "162ef1c6-6278-4dc2-aa7f-d19a5ecc1151",
790
+ "name": "Sticky Note3"
791
+ },
792
+ {
793
+ "parameters": {
794
+ "model": {
795
+ "__rl": true,
796
+ "value": "gpt-4o-mini",
797
+ "mode": "list",
798
+ "cachedResultName": "gpt-4o-mini"
799
+ },
800
+ "options": {
801
+ "maxTokens": 2000,
802
+ "temperature": 0.1
803
+ }
804
+ },
805
+ "id": "73cd2f9a-3396-4f85-ba57-3982f055209d",
806
+ "name": "GPT-4o Mini Model",
807
+ "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
808
+ "typeVersion": 1.2,
809
+ "position": [
810
+ 3180,
811
+ 980
812
+ ],
813
+ "credentials": {
814
+ "openAiApi": {
815
+ "id": "jJ43azhw4WsPfIMK",
816
+ "name": "OpenAi account"
817
+ }
818
+ }
819
+ },
820
+ {
821
+ "parameters": {},
822
+ "id": "60f3a687-87fe-4b86-8461-bda5d207dfbc",
823
+ "name": "Calculator Tool",
824
+ "type": "@n8n/n8n-nodes-langchain.toolCalculator",
825
+ "typeVersion": 1,
826
+ "position": [
827
+ 3340,
828
+ 980
829
+ ]
830
+ },
831
+ {
832
+ "parameters": {
833
+ "jsonSchemaExample": "{\n \"processing_info\": {\n \"processing_id\": \"PROC_123456789\",\n \"confidence_score\": 0.95,\n \"processing_timestamp\": \"2024-01-15T10:30:00Z\",\n \"data_completeness\": \"complete\"\n },\n \"vendor_information\": {\n \"company_name\": \"TechCorp Solutions Ltd\",\n \"address\": \"123 Business Avenue, Tech City, TC 12345\",\n \"phone\": \"+1-555-0123\",\n \"email\": \"billing@techcorp.com\",\n \"website\": \"www.techcorp.com\",\n \"tax_id\": \"TAX123456789\"\n },\n \"document_details\": {\n \"invoice_number\": \"INV-2024-001\",\n \"invoice_date\": \"2024-01-15\",\n \"due_date\": \"2024-02-15\",\n \"po_number\": \"PO-2024-456\",\n \"currency\": \"USD\",\n \"payment_terms\": \"Net 30\",\n \"reference_number\": \"REF-789\"\n },\n \"financial_summary\": {\n \"subtotal\": 1000.00,\n \"tax_rate\": 0.08,\n \"tax_amount\": 80.00,\n \"shipping_cost\": 25.00,\n \"discount_amount\": 0.00,\n \"total_amount\": 1105.00,\n \"amount_due\": 1105.00\n },\n \"line_items\": [\n {\n \"line_number\": 1,\n \"item_description\": \"Professional Software License\",\n \"item_code\": \"SW-PRO-001\",\n \"quantity\": 5,\n \"unit_price\": 200.00,\n \"line_total\": 1000.00,\n \"tax_applicable\": true\n }\n ],\n \"customer_information\": {\n \"customer_name\": \"ABC Corporation\",\n \"billing_address\": \"456 Client Street, Business Park, BP 67890\",\n \"customer_id\": \"CUST_ABC_001\",\n \"contact_person\": \"John Smith\"\n },\n \"additional_details\": {\n \"shipping_address\": \"456 Client Street, Business Park, BP 67890\",\n \"notes\": \"Thank you for your business\",\n \"terms_conditions\": \"Payment due within 30 days\",\n \"bank_details\": \"Account: 1234567890\"\n }\n}"
834
+ },
835
+ "id": "85b75e44-f3c3-4499-8e57-8c9ba4db82a3",
836
+ "name": "Structured Output Parser",
837
+ "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
838
+ "typeVersion": 1.2,
839
+ "position": [
840
+ 3640,
841
+ 980
842
+ ]
843
+ },
844
+ {
845
+ "parameters": {
846
+ "content": "## Information Extractor and parser Agent ",
847
+ "height": 560,
848
+ "width": 700,
849
+ "color": 7
850
+ },
851
+ "type": "n8n-nodes-base.stickyNote",
852
+ "position": [
853
+ 3100,
854
+ 600
855
+ ],
856
+ "typeVersion": 1,
857
+ "id": "789773b3-c9df-4aec-ad80-1a205f0f860c",
858
+ "name": "Sticky Note4"
859
+ }
860
+ ],
861
+ "pinData": {},
862
+ "connections": {
863
+ "πŸ“ Drive File Monitor": {
864
+ "main": [
865
+ [
866
+ {
867
+ "node": "⬇️ Download File",
868
+ "type": "main",
869
+ "index": 0
870
+ }
871
+ ]
872
+ ]
873
+ },
874
+ "⬇️ Download File": {
875
+ "main": [
876
+ [
877
+ {
878
+ "node": "πŸ“‚ File Type Router",
879
+ "type": "main",
880
+ "index": 0
881
+ }
882
+ ]
883
+ ]
884
+ },
885
+ "πŸ“‚ File Type Router": {
886
+ "main": [
887
+ [
888
+ {
889
+ "node": "πŸ“„ PDF Text Extractor",
890
+ "type": "main",
891
+ "index": 0
892
+ }
893
+ ],
894
+ [
895
+ {
896
+ "node": "πŸ–ΌοΈ OpenAI Image OCR",
897
+ "type": "main",
898
+ "index": 0
899
+ }
900
+ ]
901
+ ]
902
+ },
903
+ "πŸ“„ PDF Text Extractor": {
904
+ "main": [
905
+ [
906
+ {
907
+ "node": "πŸ“ Prepare PDF Data",
908
+ "type": "main",
909
+ "index": 0
910
+ }
911
+ ]
912
+ ]
913
+ },
914
+ "πŸ–ΌοΈ OpenAI Image OCR": {
915
+ "main": [
916
+ [
917
+ {
918
+ "node": "πŸ–ΌοΈ Prepare Image Data",
919
+ "type": "main",
920
+ "index": 0
921
+ }
922
+ ]
923
+ ]
924
+ },
925
+ "πŸ“ Prepare PDF Data": {
926
+ "main": [
927
+ [
928
+ {
929
+ "node": "πŸ”„ Merge Content",
930
+ "type": "main",
931
+ "index": 0
932
+ }
933
+ ]
934
+ ]
935
+ },
936
+ "πŸ–ΌοΈ Prepare Image Data": {
937
+ "main": [
938
+ [
939
+ {
940
+ "node": "πŸ”„ Merge Content",
941
+ "type": "main",
942
+ "index": 1
943
+ }
944
+ ]
945
+ ]
946
+ },
947
+ "πŸ”„ Merge Content": {
948
+ "main": [
949
+ [
950
+ {
951
+ "node": "πŸ€– AI Invoice Agent",
952
+ "type": "main",
953
+ "index": 0
954
+ }
955
+ ]
956
+ ]
957
+ },
958
+ "πŸ€– AI Invoice Agent": {
959
+ "main": [
960
+ [
961
+ {
962
+ "node": "πŸ’Ύ Store Invoice Data",
963
+ "type": "main",
964
+ "index": 0
965
+ },
966
+ {
967
+ "node": "🏒 Update Vendor Database",
968
+ "type": "main",
969
+ "index": 0
970
+ },
971
+ {
972
+ "node": "πŸ“± Telegram Notification",
973
+ "type": "main",
974
+ "index": 0
975
+ }
976
+ ]
977
+ ]
978
+ },
979
+ "Think": {
980
+ "ai_tool": [
981
+ [
982
+ {
983
+ "node": "πŸ€– AI Invoice Agent",
984
+ "type": "ai_tool",
985
+ "index": 0
986
+ }
987
+ ]
988
+ ]
989
+ },
990
+ "πŸ’Ύ Store Invoice Data": {
991
+ "main": [
992
+ []
993
+ ]
994
+ },
995
+ "GPT-4o Mini Model": {
996
+ "ai_languageModel": [
997
+ [
998
+ {
999
+ "node": "πŸ€– AI Invoice Agent",
1000
+ "type": "ai_languageModel",
1001
+ "index": 0
1002
+ }
1003
+ ]
1004
+ ]
1005
+ },
1006
+ "Calculator Tool": {
1007
+ "ai_tool": [
1008
+ [
1009
+ {
1010
+ "node": "πŸ€– AI Invoice Agent",
1011
+ "type": "ai_tool",
1012
+ "index": 0
1013
+ }
1014
+ ]
1015
+ ]
1016
+ },
1017
+ "Structured Output Parser": {
1018
+ "ai_outputParser": [
1019
+ [
1020
+ {
1021
+ "node": "πŸ€– AI Invoice Agent",
1022
+ "type": "ai_outputParser",
1023
+ "index": 0
1024
+ }
1025
+ ]
1026
+ ]
1027
+ }
1028
+ },
1029
+ "active": false,
1030
+ "settings": {
1031
+ "executionOrder": "v1"
1032
+ },
1033
+ "versionId": "a01b279a-85ac-4b1b-ac5e-6b1608faf0ac",
1034
+ "meta": {
1035
+ "templateCredsSetupCompleted": true,
1036
+ "instanceId": "cc8fbc6c0e10ac107523cabe2453f0b9216ff0ef0c1f112312039de381e2f175"
1037
+ },
1038
+ "id": "fpyE7eXLrFhAgug7",
1039
+ "tags": []
1040
+ }