From f960a87b0cc185c346d627fa999db7e99b31c368 Mon Sep 17 00:00:00 2001 From: nusquama Date: Sun, 15 Mar 2026 12:02:07 +0800 Subject: [PATCH] creation --- ...images_to_excel_365_using_tesseract_ocr_and_gpt-4.1-mini.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 workflows/Log Telegram receipt images to Excel 365 using Tesseract OCR and GPT-4.1-mini-13897/log_telegram_receipt_images_to_excel_365_using_tesseract_ocr_and_gpt-4.1-mini.json diff --git a/workflows/Log Telegram receipt images to Excel 365 using Tesseract OCR and GPT-4.1-mini-13897/log_telegram_receipt_images_to_excel_365_using_tesseract_ocr_and_gpt-4.1-mini.json b/workflows/Log Telegram receipt images to Excel 365 using Tesseract OCR and GPT-4.1-mini-13897/log_telegram_receipt_images_to_excel_365_using_tesseract_ocr_and_gpt-4.1-mini.json new file mode 100644 index 000000000..8db5cf996 --- /dev/null +++ b/workflows/Log Telegram receipt images to Excel 365 using Tesseract OCR and GPT-4.1-mini-13897/log_telegram_receipt_images_to_excel_365_using_tesseract_ocr_and_gpt-4.1-mini.json @@ -0,0 +1 @@ +{"id":"61JuaEH4hd2v0Uck","meta":{"instanceId":"6cc986a902b3f0ff9240ae3d0468a1ce9791fa6b4506fb60ba160c17b5ef243b","templateCredsSetupCompleted":true},"name":"Log receipt transactions from Telegram images to Excel using OCR and AI","tags":[],"nodes":[{"id":"819bc3ef-5fd4-49b5-9d9b-79c64ce99257","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[-560,-208],"webhookId":"0accf8c4-340c-46ed-9c96-21d0236f649a","parameters":{"updates":["message"],"additionalFields":{}},"credentials":{"telegramApi":{"id":"6J601ERS9nhYggYZ","name":"EngineN8N"}},"typeVersion":1.2},{"id":"afb73b10-60bf-4ba3-96cb-f0891f6ac5a7","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-592,-320],"parameters":{"color":7,"width":784,"height":336,"content":"## Telegram trigger\nReceive receipt images from a Telegram bot and extract chat and file information for further processing."},"typeVersion":1},{"id":"46c06288-e7a5-415e-a468-00eb254ffb87","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[208,-160],"parameters":{"color":7,"width":368,"height":272,"content":"## Image processing and OCR\nDownload the image and extract text content from the receipt using OCR."},"typeVersion":1},{"id":"25e7ac1a-0def-4a36-80ed-ebce8568e05b","name":"Get Configurations","type":"n8n-nodes-base.microsoftExcel","position":[1168,128],"parameters":{"table":{"__rl":true,"mode":"list","value":"{B7096518-B554-244F-8F76-F9312CAA7C95}","cachedResultUrl":"https://onedrive.live.com/personal/f1cfeff06c99e405/_layouts/15/doc.aspx?resid=1736a44f-46ee-4594-ac0c-ca2529c411a8&cid=f1cfeff06c99e405&activeCell='Smart%20Expense%20Guardian'!T2:U4","cachedResultName":"Configuration"},"filters":{},"resource":"table","workbook":{"__rl":true,"mode":"list","value":"F1CFEFF06C99E405!s1736a44f46ee4594ac0cca2529c411a8","cachedResultUrl":"https://onedrive.live.com/personal/f1cfeff06c99e405/_layouts/15/doc.aspx?resid=1736a44f-46ee-4594-ac0c-ca2529c411a8&cid=f1cfeff06c99e405","cachedResultName":"Contoh Excel N8N"},"operation":"getRows","returnAll":true,"worksheet":{"__rl":true,"mode":"list","value":"{4F511F74-E4EF-724A-B672-D8B727689111}","cachedResultUrl":"https://onedrive.live.com/personal/f1cfeff06c99e405/_layouts/15/doc.aspx?resid=1736a44f-46ee-4594-ac0c-ca2529c411a8&cid=f1cfeff06c99e405&activeCell=Smart%20Expense%20Guardian!A1","cachedResultName":"Smart Expense Guardian"}},"credentials":{"microsoftExcelOAuth2Api":{"id":"qnIkRYtuEc5DZ5My","name":"Microsoft Excel account"}},"typeVersion":2.2},{"id":"c1e967bf-9e1b-435f-bafd-80a273e4125c","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[624,144],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1-mini"},"options":{},"builtInTools":{}},"credentials":{"openAiApi":{"id":"lVI4clWZ5wIGz2Oh","name":"OpenAi account"}},"typeVersion":1.3},{"id":"26f32c5e-b7bd-4938-928b-522480d83b8d","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1136,-144],"parameters":{"color":7,"width":832,"height":464,"content":"## Data validation and duplicate check\nValidate required transaction fields and prevent duplicate records."},"typeVersion":1},{"id":"ff0a7696-9d59-4fea-8170-c579dbf7f9f0","name":"Tesseract OCR","type":"n8n-nodes-tesseractjs.tesseractNode","position":[448,-48],"parameters":{"options":{}},"typeVersion":1},{"id":"cc65e743-24a7-4020-953c-acc949d1170a","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-1632,-848],"parameters":{"width":992,"height":1952,"content":"# 📸💰 Log receipt transactions from Telegram images to Excel using OCR and AI\n\nOCR + AI + Duplicate Protection (n8n Workflow)\n\n⸻\n\n## Overview\n\nThis workflow automatically converts receipt images or payment proof sent via Telegram into structured financial records stored in Excel 365.\n\nCore flow:\n```\nTake Photo → OCR → AI Structuring → Validation → Duplicate Check → Append to Excel\n```\nThe system is designed to reduce manual data entry errors and improve financial visibility by turning unstructured receipt images into reliable financial records.\n\n⸻\n\n## 🧠 What This Workflow Does\n\nThis workflow automatically:\n- Captures receipt images from Telegram\n- Extracts text using OCR\n- Converts OCR text into structured transaction data using AI\n- Validates required financial fields\n- Prevents duplicate transaction entries\n- Saves valid records into Excel\n- Sends confirmation messages to Telegram\n\n⸻\n\n## 🎯 Key Benefits\n\t•\tReduce financial recording errors\n\t•\tEliminate repetitive manual data entry\n\t•\tImprove cashflow visibility\n\t•\tSimple photo-based financial recording\n\t•\tScalable foundation for AI-powered financial automation\n\n⸻\n\n## 🚀 Use Cases\n\nThis workflow is useful for:\n\t•\tSmall business owners\n\t•\tOnline sellers\n\t•\tFreelancers\n\t•\tFinance administrators\n\t•\tPersonal expense tracking\n\n⸻\n\n## 📌 Notes\n\t•\tDuplicate detection is based on a composite transaction key\n\t•\tOCR accuracy depends on image quality\n\t•\tAI parsing improves recognition compared to OCR-only approaches\n\n⸻\n\n## 🧱 Requirements\n\nTo run this workflow you need:\n\t•\tn8n (Cloud or Self-Hosted)\n\t•\tTelegram Bot Token\n\t•\tMicrosoft Excel 365 Account\n\t•\tOpenAI API Key or Google Gemini API Key\n\t•\tTesseract OCR (for self-hosted installations)\n\n⸻\n\n## 🏁 Result\n\nAfter setup, users can simply send receipt photos to Telegram and the workflow will automatically convert them into structured financial records stored in Excel.\n\nNo manual bookkeeping required.\n\n⸻\n\nBuilt for automation lovers, small businesses, and teams who want simple but powerful financial tracking using n8n."},"typeVersion":1},{"id":"f73bb7a8-7d3a-4334-8bda-b7e15d90cd40","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-48,-848],"parameters":{"color":3,"width":512,"height":448,"content":"## Workflow Nodes\n\nThe workflow contains the following nodes:\n1. Telegram Trigger\n1. Edit Fields (extract chat_id and image_id)\n1. Condition (validate image exists)\n1. Telegram Get File\n1. Tesseract OCR\n1. AI Agent (ChatGPT / Gemini)\n1. Edit Field (JSON Output Parsing)\n1. Excel 365 – Get Configuration\n1. Edit Field – Normalize & Generate duplicate_key\n1. Condition – Validate required fields\n1. Excel 365 – Lookup duplicate_key\n1. Condition – Duplicate Check\n1. Excel 365 – Append Transaction\n1. Telegram – Send Confirmation Message"},"typeVersion":1},{"id":"f208e594-4afd-4dfd-a5ce-4c34a7891b34","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[512,-848],"parameters":{"color":4,"width":512,"height":288,"content":"## Setup steps\n1. Create a Telegram bot using @BotFather and copy the Bot Token.\n2. Add Telegram credentials in n8n using the Bot Token.\n3. Prepare an Excel file in OneDrive or SharePoint with a TRANSACTIONS sheet.\n4. Configure Microsoft Excel credentials in n8n.\n5. Add either OpenAI or Google Gemini credentials for the AI parsing step.\n6. If running self-hosted n8n, ensure Tesseract OCR is installed.\n7. Activate the workflow and send a receipt image to the Telegram bot to test."},"typeVersion":1},{"id":"b5704a52-2032-4f8c-97b8-fc1b758065f6","name":"Send Notification","type":"n8n-nodes-base.telegram","position":[64,-224],"webhookId":"3dc7bf65-a7f2-46dd-acb0-ba91857553d9","parameters":{"text":"Attachment required","chatId":"={{ $('Telegram Trigger').item.json.message.from.id }}","additionalFields":{}},"credentials":{"telegramApi":{"id":"Qmq6Z145HSXhc5e0","name":"Telegram account"}},"typeVersion":1.2},{"id":"741be234-6dca-4a98-b931-808d1d8ad32e","name":"Send Notification image not valid","type":"n8n-nodes-base.telegram","position":[1616,128],"webhookId":"7ecbbd1b-dc78-497d-8689-d5d1f89346c3","parameters":{"text":"Receipt could not be validated. Please resend.","chatId":"={{ $('Telegram Trigger').item.json.message.from.id }}","additionalFields":{}},"credentials":{"telegramApi":{"id":"6J601ERS9nhYggYZ","name":"EngineN8N"}},"typeVersion":1.2},{"id":"7e1f9c61-2130-4390-85f2-5bdd27e8767c","name":"Send notification duplicate","type":"n8n-nodes-base.telegram","position":[2096,-80],"webhookId":"854ef359-074e-4390-a3c7-f06db9c52da0","parameters":{"text":"Possible duplicate receipt detected.","chatId":"={{ $('Telegram Trigger').item.json.message.from.id }}","additionalFields":{}},"credentials":{"telegramApi":{"id":"6J601ERS9nhYggYZ","name":"EngineN8N"}},"typeVersion":1.2},{"id":"16d68a8c-60ef-436e-89a6-af22fe57a918","name":"Telegram get file","type":"n8n-nodes-base.telegram","position":[240,-48],"webhookId":"ac4a6f42-e8ac-4c03-9250-d16ca10d16cf","parameters":{"fileId":"={{ $json.Image.replace(/\\n/g, '') }}","resource":"file","additionalFields":{}},"credentials":{"telegramApi":{"id":"6J601ERS9nhYggYZ","name":"EngineN8N"}},"typeVersion":1.2},{"id":"0fdb8423-d76a-4561-b832-45aed67b683c","name":"JSON output parsing","type":"n8n-nodes-base.set","position":[960,-48],"parameters":{"mode":"raw","options":{},"jsonOutput":"={{ $json.output }}"},"typeVersion":3.4},{"id":"71f1d4a1-3bf6-4030-9d78-1d52775c71bd","name":"Send confirmation message","type":"n8n-nodes-base.telegram","position":[2096,256],"webhookId":"7d48dab9-c755-41da-a69c-95783d7ba477","parameters":{"text":"=Receipt recorded successfully.\n","chatId":"={{ $('Telegram Trigger').item.json.message.from.id }}","additionalFields":{}},"credentials":{"telegramApi":{"id":"6J601ERS9nhYggYZ","name":"EngineN8N"}},"typeVersion":1.2},{"id":"a3576579-cb15-4324-8920-b3787ed336b6","name":"Parse receipt data with AI","type":"@n8n/n8n-nodes-langchain.agent","position":[624,-48],"parameters":{"text":"=Here is the OCR text:\n\n{{ $json.text }}","options":{"systemMessage":"You are a financial transaction parser for Indonesian OCR text.\n\nYour task is to extract structured transaction data from noisy OCR text.\n\nThe OCR text may contain:\n- spelling errors\n- misaligned layout\n- duplicated lines\n- random symbols\n\nYou must strictly follow the extraction and validation rules below.\n\n--------------------------------------------------\nSECTION 1 — TRANSACTION TYPE CLASSIFICATION\n--------------------------------------------------\n\nDetermine transaction_type using these rules:\n\nIf text contains:\n- \"Transfer\", \"Transfer Berhasil\", \"BI Fast\", \"No. Referensi\"\n→ transaction_type = \"TRANSFER\"\n\nIf text resembles store receipt (items, subtotal, cashier, etc.)\n→ transaction_type = \"PURCHASE\"\n\nIf text contains e-wallet brand (OVO, DANA, GoPay, ShopeePay, etc.)\n→ transaction_type = \"EWALLET\"\n\nOtherwise:\n→ transaction_type = \"OTHER\"\n\n--------------------------------------------------\nSECTION 2 — FIELD EXTRACTION RULES\n--------------------------------------------------\n\nsender_name:\n- Extract account owner or source of funds.\n- Usually under \"Rekening Sumber\", \"From\", or similar.\n\nsender_bank:\n- Extract bank of sender if available.\n\nrecipient_name:\n- Extract the party receiving funds.\n- Usually appears after \"Penerima\" or \"To\".\n\nrecipient_bank:\n- Extract bank of recipient if available.\n\nmerchant_name:\n- If transaction_type = TRANSFER:\n merchant_name MUST equal recipient_name.\n- If PURCHASE or EWALLET:\n merchant_name is the store or business name.\n- Never use footer bank company as merchant.\n\namount:\n- Extract main transfer or purchase amount.\n- Remove \"Rp\", \".\", \",\".\n- Return numbers only (example: 1320000)\n\nfee:\n- Extract transaction fee if available.\n- If not present → null.\n\ntotal_amount:\n- Extract total including fee if present.\n- If not explicitly present:\n total_amount = amount + fee (if fee exists)\n- Return numbers only.\n\ntransaction_datetime:\n- Combine date and time if available.\n- Convert to ISO format: YYYY-MM-DD HH:MM:SS\n- If only date exists → time = 00:00:00\n\nreference_number:\n- Extract transaction reference number if available.\n\ndescription:\n- Extract transaction note or description if available.\n- Example: \"beras 100 kg\"\n\n--------------------------------------------------\nSECTION 3 — VALIDATION RULES (MANDATORY)\n--------------------------------------------------\n\n1. All monetary fields must contain digits only.\n Example: 1322500\n\n2. merchant_name MUST NOT contain:\n - \"Bank Mandiri\"\n - \"Bank Central Asia\"\n - \"Persero\"\n - \"Tbk\"\n unless transaction_type is PURCHASE inside a bank branch.\n\n3. If transaction_type = TRANSFER:\n - recipient_name cannot be null.\n - merchant_name must equal recipient_name.\n\n4. If total_amount < amount:\n - total_amount = amount.\n\n5. If required field cannot be confidently extracted:\n return null.\n\n6. Do NOT hallucinate.\n Only extract what is clearly present.\n\n--------------------------------------------------\nSECTION 4 — OUTPUT FORMAT\n--------------------------------------------------\n\nReturn strictly valid JSON with this exact structure:\n\n{\n \"transaction_type\": \"\",\n \"sender_name\": \"\",\n \"sender_bank\": \"\",\n \"recipient_name\": \"\",\n \"recipient_bank\": \"\",\n \"merchant_name\": \"\",\n \"amount\": \"\",\n \"fee\": \"\",\n \"total_amount\": \"\",\n \"transaction_datetime\": \"\",\n \"reference_number\": \"\",\n \"description\": \"\"\n}\n\nDo not add explanation.\nDo not add comments.\nReturn JSON only."},"promptType":"define"},"typeVersion":3},{"id":"b07deb69-9ce2-4015-8771-14a5802d6148","name":"Extract Telegram chat and file ID","type":"n8n-nodes-base.set","position":[-352,-208],"parameters":{"options":{},"assignments":{"assignments":[{"id":"80512649-c259-41ce-aa56-9b6da7635cfd","name":"chatID","type":"string","value":"={{ $json.message.chat.id }}"},{"id":"e7e8d4b1-2caa-4322-bb99-2423ee852b9e","name":"Image","type":"string","value":"={{ $json[\"message\"][\"photo\"][$json[\"message\"][\"photo\"].length - 1][\"file_id\"] }}"}]}},"typeVersion":3.4},{"id":"adb93c83-4894-4b95-a58a-9c7d83b01bd7","name":"Check if image was uploaded","type":"n8n-nodes-base.if","position":[-144,-208],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"bc8d82cf-c9eb-4a8c-80bd-61d3f097a048","operator":{"type":"string","operation":"empty","singleValue":true},"leftValue":"={{ $json.Image }}","rightValue":""}]}},"typeVersion":2.2},{"id":"102aaa27-07a3-4021-96b2-0cc39dc2bbfe","name":"Validate required transaction fields","type":"n8n-nodes-base.if","position":[1360,-48],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"3f2da5f5-592b-4768-9292-3b13a2c6fd6f","operator":{"type":"number","operation":"notEmpty","singleValue":true},"leftValue":"={{ parseInt($('JSON output parsing').first().total_amount) }}","rightValue":0},{"id":"631d0431-8c04-45fc-bd5b-c1c2b18f25a3","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $('JSON output parsing').first().json.transaction_type }}","rightValue":""}]}},"typeVersion":2.2},{"id":"87ecde57-e303-4a87-a71f-e04a33cc29df","name":"Check for duplicate transaction","type":"n8n-nodes-base.if","position":[1824,-64],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"62248e87-89cd-43a0-bc50-247a72cee955","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ parseInt($json.length)>0 }}","rightValue":"0"}]}},"typeVersion":2.2,"alwaysOutputData":false},{"id":"feb8c68e-5132-4949-8b49-2bbb85e348c8","name":"Normalize transaction data","type":"n8n-nodes-base.set","position":[1168,-48],"parameters":{"options":{},"assignments":{"assignments":[{"id":"8bd2c278-299a-44e9-ab0c-d8072f352dad","name":"normalized_total","type":"string","value":"={{ parseFloat($('JSON output parsing').first().json.total_amount.toString().replace(/[^0-9.]/g, \"\")) }}"},{"id":"1233a4cd-01d6-458f-a8b3-0bae466b9710","name":"normalized_sender_name","type":"string","value":"={{ $('JSON output parsing').first().json.sender_name.toUpperCase().replace(/\\s+/g,'') }}"},{"id":"020033ea-e06f-4119-9ed4-5d0c24f6fd3d","name":"normalized_merchant_name","type":"string","value":"={{ $('JSON output parsing').first().json.merchant_name.toUpperCase().replace(/\\s+/g,'') }}"},{"id":"557802a2-712b-4b6b-9433-11db53bea9d8","name":"LIMIT_AMOUNT_REVIEW","type":"string","value":"={{ $('Get Configurations').all().find(i => i.json.Key === \"LIMIT_AMOUNT_REVIEW\")?.json.Value}}"},{"id":"f665ff01-ee64-4915-a838-c65457d64f64","name":"CHAT_ID_APPROVER","type":"string","value":"={{ $('Get Configurations').all().find(i => i.json.Key === \"CHAT_ID_APPROVER\")?.json.Value}}"},{"id":"fe97d3f2-474b-440b-b26c-1eb320c52d84","name":"ENABLE_DUPLICATE_CHECK","type":"string","value":"={{ $('Get Configurations').all().find(i => i.json.Key === \"ENABLE_DUPLICATE_CHECK\")?.json.Value}}"},{"id":"94ae5c0f-f20f-4df7-90b3-957df49be9f3","name":"DUPLICATE_STRATEGY","type":"string","value":"={{ $('Get Configurations').all().find(i => i.json.Key === \"DUPLICATE_STRATEGY\")?.json.Value}}"},{"id":"76978a03-354a-473c-9426-8b720c6f412b","name":"DEFAULT_TIMEZONE","type":"string","value":"={{ $('Get Configurations').all().find(i => i.json.Key === \"DUPLICATE_STRATEGY\")?.json.Value}}"},{"id":"bcb6aa1f-6f60-4177-82c9-e9adea43c37d","name":"AUTO_APPEND","type":"string","value":"={{ $('Get Configurations').all().find(i => i.json.Key === \"AUTO_APPEND\")?.json.Value}}"},{"id":"9f03c4c7-0017-4d9c-b2ec-12461969c9c5","name":"REQUIRE_REFERENCE","type":"string","value":"={{ $('Get Configurations').all().find(i => i.json.Key === \"REQUIRE_REFERENCE\")?.json.Value}}"},{"id":"2e17f5da-d7e9-49f5-91d9-6b35d258d82c","name":"REVIEW_MODE","type":"string","value":"={{ $('Get Configurations').all().find(i => i.json.Key === \"REVIEW_MODE\")?.json.Value}}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"70ddd1c8-c268-4e07-b6db-fcf16e1fc2f4","name":"Check existing transaction in Excel","type":"n8n-nodes-base.microsoftExcel","position":[1616,-64],"parameters":{"table":{"__rl":true,"mode":"list","value":"{9EB6CC00-FE19-1C42-B043-A14CDB0E049D}","cachedResultUrl":"https://onedrive.live.com/personal/f1cfeff06c99e405/_layouts/15/doc.aspx?resid=1736a44f-46ee-4594-ac0c-ca2529c411a8&cid=f1cfeff06c99e405&activeCell='Smart%20Expense%20Guardian'!A1:G2","cachedResultName":"FinanceIntake"},"options":{"returnAllMatches":true},"resource":"table","workbook":{"__rl":true,"mode":"list","value":"F1CFEFF06C99E405!s1736a44f46ee4594ac0cca2529c411a8","cachedResultUrl":"https://onedrive.live.com/personal/f1cfeff06c99e405/_layouts/15/doc.aspx?resid=1736a44f-46ee-4594-ac0c-ca2529c411a8&cid=f1cfeff06c99e405","cachedResultName":"Contoh Excel N8N"},"operation":"lookup","worksheet":{"__rl":true,"mode":"list","value":"{4F511F74-E4EF-724A-B672-D8B727689111}","cachedResultUrl":"https://onedrive.live.com/personal/f1cfeff06c99e405/_layouts/15/doc.aspx?resid=1736a44f-46ee-4594-ac0c-ca2529c411a8&cid=f1cfeff06c99e405&activeCell=Smart%20Expense%20Guardian!A1","cachedResultName":"Smart Expense Guardian"},"lookupValue":"={{ $json.normalized_vendor + \"_\" + $json.date + \"_\" + $json.normalized_total }}","lookupColumn":"Duplicate Key"},"credentials":{"microsoftExcelOAuth2Api":{"id":"qnIkRYtuEc5DZ5My","name":"Microsoft Excel account"}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"276fcaca-0320-4167-b20f-ebf34944cef3","name":"Save transaction to Excel","type":"n8n-nodes-base.microsoftExcel","position":[2096,96],"parameters":{"table":{"__rl":true,"mode":"list","value":"{9EB6CC00-FE19-1C42-B043-A14CDB0E049D}","cachedResultUrl":"https://onedrive.live.com/personal/f1cfeff06c99e405/_layouts/15/doc.aspx?resid=1736a44f-46ee-4594-ac0c-ca2529c411a8&cid=f1cfeff06c99e405&activeCell='Smart%20Expense%20Guardian'!A1:H2","cachedResultName":"FinanceIntake"},"options":{},"fieldsUi":{"values":[{"column":"Sender Name","fieldValue":"={{ $('Validate required transaction fields').item.json.sender_name }}"},{"column":"Sender Bank","fieldValue":"={{ $('Validate required transaction fields').item.json.sender_bank }}"},{"column":"Recipient Name","fieldValue":"={{ $('Validate required transaction fields').item.json.recipient_name }}"},{"column":"Recipient Bank","fieldValue":"={{ $('Validate required transaction fields').item.json.recipient_bank }}"},{"column":"Merchant Name","fieldValue":"={{ $('Validate required transaction fields').item.json.merchant_name }}"},{"column":"Transaction Type","fieldValue":"={{ $('Validate required transaction fields').item.json.transaction_type }}"},{"column":"Submitted By","fieldValue":"={{ $('Telegram Trigger').item.json.message.from.first_name }}"},{"column":"Duplicate Key","fieldValue":"={{ $('Validate required transaction fields').item.json.transaction_type=='TRANSFER' ? ($('Validate required transaction fields').item.json.transaction_datetime + $('Validate required transaction fields').item.json.total_amount + $('Validate required transaction fields').item.json.recipient_name) : ($('Validate required transaction fields').item.json.transaction_datetime + $('Validate required transaction fields').item.json.total_amount + $('Validate required transaction fields').item.json.merchant_name)}}"},{"column":"Status","fieldValue":"={{ $('Validate required transaction fields').item.json.normalized_total>=$('Get Configurations').item.json.Value ? 'Pending' : 'Approved' }}"},{"column":"Submission ID","fieldValue":"={{$execution.id}}"},{"column":"Created","fieldValue":"={{ $now }}"},{"column":"Amount","fieldValue":"={{ $('Validate required transaction fields').item.json.amount }}"},{"column":"Fee","fieldValue":"={{ $('Validate required transaction fields').item.json.fee }}"},{"column":"Total Amount","fieldValue":"={{ $('Validate required transaction fields').item.json.total_amount }}"},{"column":"Transaction Date","fieldValue":"={{ $('Validate required transaction fields').item.json.transaction_datetime }}"},{"column":"Reference Number","fieldValue":"={{ $('Validate required transaction fields').item.json.reference_number }}"},{"column":"Description","fieldValue":"={{ $('Validate required transaction fields').item.json.description }}"}]},"resource":"table","workbook":{"__rl":true,"mode":"list","value":"F1CFEFF06C99E405!s1736a44f46ee4594ac0cca2529c411a8","cachedResultUrl":"https://onedrive.live.com/personal/f1cfeff06c99e405/_layouts/15/doc.aspx?resid=1736a44f-46ee-4594-ac0c-ca2529c411a8&cid=f1cfeff06c99e405","cachedResultName":"Contoh Excel N8N"},"worksheet":{"__rl":true,"mode":"list","value":"{4F511F74-E4EF-724A-B672-D8B727689111}","cachedResultUrl":"https://onedrive.live.com/personal/f1cfeff06c99e405/_layouts/15/doc.aspx?resid=1736a44f-46ee-4594-ac0c-ca2529c411a8&cid=f1cfeff06c99e405&activeCell=Smart%20Expense%20Guardian!A1","cachedResultName":"Smart Expense Guardian"}},"credentials":{"microsoftExcelOAuth2Api":{"id":"qnIkRYtuEc5DZ5My","name":"Microsoft Excel account"}},"typeVersion":2.2},{"id":"76e71511-5fd0-48e3-b413-c872e2b58fda","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-608,-848],"parameters":{"color":5,"width":512,"height":448,"content":"## How it works\nThis workflow captures receipt images sent to a Telegram bot and converts them into structured financial records in Excel.\n\nWhen a user sends an image, the workflow downloads the file and extracts the text using OCR. The extracted text is then analyzed by an AI model (OpenAI or Gemini) to identify key transaction details such as date, amount, merchant, and transaction type.\n\nThe workflow validates the extracted data and generates a unique duplicate key. It then checks Excel to ensure the transaction has not already been recorded. If no duplicate is found, the transaction is appended to the Excel sheet.\n\nThe user receives a confirmation message in Telegram indicating whether the transaction was successfully recorded or rejected due to missing data or duplication.\n\n"},"typeVersion":1},{"id":"984ad9dc-a337-4d44-98da-45d91f8da683","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[592,-144],"parameters":{"color":7,"width":528,"height":240,"content":"## AI data extraction\nConvert raw OCR text into structured transaction data using an AI model."},"typeVersion":1},{"id":"74153927-8fb0-4729-aeb2-a78fa61cde5f","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[2000,-224],"parameters":{"color":7,"width":320,"height":672,"content":"## Save transaction and notify user\nStore the transaction in Excel and send a confirmation message to Telegram."},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"1806959a-9d7f-40f5-a66d-074923eba94e","connections":{"Tesseract OCR":{"main":[[{"node":"Parse receipt data with AI","type":"main","index":0}]]},"Telegram Trigger":{"main":[[{"node":"Extract Telegram chat and file ID","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Parse receipt data with AI","type":"ai_languageModel","index":0}]]},"Telegram get file":{"main":[[{"node":"Tesseract OCR","type":"main","index":0}]]},"Get Configurations":{"main":[[{"node":"Normalize transaction data","type":"main","index":0}]]},"JSON output parsing":{"main":[[{"node":"Normalize transaction data","type":"main","index":0},{"node":"Get Configurations","type":"main","index":0}]]},"Save transaction to Excel":{"main":[[]]},"Send confirmation message":{"main":[[]]},"Normalize transaction data":{"main":[[{"node":"Validate required transaction fields","type":"main","index":0}]]},"Parse receipt data with AI":{"main":[[{"node":"JSON output parsing","type":"main","index":0}]]},"Check if image was uploaded":{"main":[[{"node":"Send Notification","type":"main","index":0}],[{"node":"Telegram get file","type":"main","index":0}]]},"Check for duplicate transaction":{"main":[[{"node":"Send notification duplicate","type":"main","index":0}],[{"node":"Save transaction to Excel","type":"main","index":0},{"node":"Send confirmation message","type":"main","index":0}]]},"Extract Telegram chat and file ID":{"main":[[{"node":"Check if image was uploaded","type":"main","index":0}]]},"Check existing transaction in Excel":{"main":[[{"node":"Check for duplicate transaction","type":"main","index":0}]]},"Validate required transaction fields":{"main":[[{"node":"Check existing transaction in Excel","type":"main","index":0}],[{"node":"Send Notification image not valid","type":"main","index":0}]]}}} \ No newline at end of file