{"workflow":{"id":14496,"name":"Record Odoo accounting entries from Telegram using ChatGPT (GPT-4o-mini)","views":22,"recentViews":3,"totalViews":22,"createdAt":"2026-03-30T16:22:20.092Z","description":"## What Problem Does It Solve?\n- Business owners, managers, and accountants waste valuable time manually entering daily expenses, supplier payments, and employee advances into Odoo. \n- Getting quick balance reports usually requires logging into the ERP, navigating multiple menus, and generating complex reports. \n- Managing post-dated checks often relies on manual tracking, leading to missed due dates.\n- This workflow solves these by:\n-- Allowing users to record financial transactions simply by sending a natural language message (e.g., via Telegram or Botpress).\n-- Automatically fetching real-time account balances and supplier statements, returning them instantly in the chat.\n-- Setting up automated calendar reminders for post-dated check due dates.\n-- Handling the entire double-entry accounting process in the background without human intervention.\n\n## How to Configure It\n- **Chat Platform Setup**\n-- Add the webhook URL from this workflow to your Telegram Bot, Botpress, or preferred chat interface.\n- **Odoo Setup**\n-- Connect your Odoo credentials in n8n.\n-- Open the \"Build [X] Entry\" code nodes and replace the placeholder `journal_id` and `currency_id` with your actual Odoo system IDs.\n- **AI Setup**\n-- Add your OpenAI API key (or swap the node for Google Gemini/Anthropic).\n-- Open the \"AI Financial Agent\" node and update the `# ACCOUNT MAPPING` section with your specific Odoo Chart of Accounts codes.\n- **Calendar Setup (Optional)**\n-- Connect your Google Calendar credentials if you want the workflow to automatically schedule reminders for check due dates.\n\n## How It Works\n- Webhook catches the new text message from your chat platform.\n- An AI Agent analyzes the Arabic natural language and extracts the intent, amount, date, check details, and specific account categories.\n- Routing: \n-- For Expenses, Payments, or Advances → The workflow searches Odoo for the correct IDs, builds a balanced double-entry journal record, creates it, and posts it.\n-- For Post-Dated Checks → Extracts the due date and creates a Google Calendar event before posting the entry to Odoo.\n-- For Balance Inquiries → Fetches the relevant ledger lines, calculates total debits/credits, and formats a clean Arabic text summary.\n- A success confirmation or the requested financial report is instantly sent back to the user in the chat.\n\n## Customization Ideas\n- Expand the AI prompt and routing switch to handle Customer Invoices or internal Petty Cash transfers.\n- Add an approval step (e.g., sending a Slack/Email button) before the workflow officially \"posts\" large transactions in Odoo.\n- Change the AI prompt to support multiple languages or different regional dialects.\n- Log a backup of all financial chat requests into Google Sheets or a Notion database for auditing.\n\nFor more info [Contact Me](https://www.linkedin.com/in/khaledyasser01/)","workflow":{"id":"k2YnknQUWqF88QOLuH41o","meta":{"instanceId":"54413d0a29f58a504d49f66b9840302ccdb92a86f1e75336be89761149ecc946","templateCredsSetupCompleted":true},"name":"Automate Odoo Accounting with Telegram and ChatGPT","tags":[],"nodes":[{"id":"26bf9399-e7c0-4104-aaf0-b1fe1ad975a6","name":"Bot Data Receiver","type":"n8n-nodes-base.webhook","position":[-2000,1328],"webhookId":"YOUR_WEBHOOK_UUID","parameters":{"path":"YOUR_WEBHOOK_UUID","options":{},"httpMethod":"POST","responseMode":"responseNode"},"typeVersion":2.1},{"id":"0e948798-59d4-4061-8640-9bbf3e26eb3c","name":"Find Expense Account ID","type":"n8n-nodes-base.odoo","position":[32,560],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $json.entities.debit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"c55ccf3f-64ca-4952-8eef-209eb4676301","name":"Find Cash Account ID","type":"n8n-nodes-base.odoo","position":[256,560],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Route to Expense Path').item.json.entities.credit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"1d8fa225-a34c-467c-aa54-59d397b046e7","name":"Confirm & Post Entry","type":"n8n-nodes-base.odoo","position":[928,560],"parameters":{"resource":"custom","operation":"update","customResource":"account.move","customResourceId":"={{ $json.id }}","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"state","fieldValue":"posted"}]}},"typeVersion":1},{"id":"afe2f67f-92dd-41b6-9cff-47edf75e584e","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-1776,1552],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{},"builtInTools":{}},"typeVersion":1.3},{"id":"cc3c17dd-e763-4816-a6f6-48e608cae9ff","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-1648,1552],"parameters":{"sessionKey":"chat_history","sessionIdType":"customKey","contextWindowLength":50},"typeVersion":1.3},{"id":"68be6e21-c635-4d98-8395-bfbeb6d62586","name":"AI Financial Agent","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueRegularOutput","position":[-1776,1328],"parameters":{"text":"={{ JSON.stringify($json.body) }}","options":{"systemMessage":"=You are an expert Financial Intent Classifier for Odoo ERP. Output ONLY a valid JSON object.\n\n# CORE DECISION LOGIC (CRITICAL):\n1. IF the user mentions an AMOUNT and an EXPENSE CATEGORY:\n   -> route_path MUST BE \"save_expense\"\n   -> action_type MUST BE \"save\"\n2. IF the user asks for a REPORT or BALANCE (No amount):\n   -> route_path MUST BE \"fetch_expense_report\" or \"fetch_safe_balance\"\n   -> action_type MUST BE \"fetch\"\n\n# ROUTE PATHS:\n- \"save_expense\": Recording an expense.\n- \"save_supplier_payment\": Paying a supplier.\n- \"fetch_safe_balance\": Inquiries about balances/checks.\n- \"fetch_expense_report\": Inquiries about expense totals.\n- \"fetch_supplier_statement\": Supplier statement.\n\n# ACCOUNT MAPPING (TEMPLATE - UPDATE THESE CODES):\n- Safes/Checks: [SAFE_1_NAME]=[SAFE_1_CODE] | [SAFE_2_NAME]=[SAFE_2_CODE] | [CHECKS_NAME]=[CHECKS_CODE] | [WALLET_NAME]=[WALLET_CODE]\n- Expenses: 1. [EXPENSE_1_NAME]=[EXPENSE_1_CODE] | 2. [EXPENSE_2_NAME]=[EXPENSE_2_CODE] \n\n# SPECIAL LOGIC FOR CHECKS (شيكات):\n- IF recording an expense paid by \"شيك\": You MUST set source=\"شيكات\", credit_code=\"[CHECKS_CODE]\", and debit_code to the expense account. You MUST extract \"check_number\" and \"due_date\".\n\n# JSON SCHEMA:\n{\n  \"route_path\": \"string\",\n  \"company\": \"[COMPANY_A]\" | \"[COMPANY_B]\" | null,\n  \"action_type\": \"save|fetch\", \n  \"entities\": {\n    \"amount\": number,\n    \"source\": \"string|null\",\n    \"target_name\": \"string|null\",\n    \"credit_code\": \"string|null\",\n    \"debit_code\": \"string|null\",\n    \"category_or_type\": \"string|null\",\n    \"date_filter\": \"today|yesterday|null\",\n    \"check_details\": {\"check_number\": \"string\", \"due_date\": \"string\"}\n  },\n  \"is_complete\": true\n}"},"promptType":"define"},"typeVersion":3.1},{"id":"7e93fd70-aaef-40a3-a4da-a06fe4e3f81e","name":"Clean AI Output","type":"n8n-nodes-base.code","position":[-1424,1328],"parameters":{"jsCode":"// 1. Extract response\nlet inputData = $input.first().json;\nlet rawString = inputData.text || inputData.output || inputData.message || \"\";\n\n// 2. Clean markdown code fences and parse JSON\nlet cleanString = rawString.replace(/```json\\n?/gi, '').replace(/```\\n?/gi, '').trim();\n\n// 3. Try to extract JSON object\nlet jsonMatch = cleanString.match(/\\{[\\s\\S]*\\}/);\nif (jsonMatch) {\n  cleanString = jsonMatch[0];\n}\n\n// 4. Parse and return\nlet parsed = JSON.parse(cleanString);\nreturn parsed;"},"typeVersion":2},{"id":"1bcda57f-cf6a-49d6-a016-05153da77f2e","name":"Route to Expense Path","type":"n8n-nodes-base.switch","position":[-1120,1248],"parameters":{"rules":{"values":[{"outputKey":"Expense Path","conditions":{"options":{"version":3,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"40764b6c-4e80-4fcb-8e3d-24132ddeb919","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.route_path }}","rightValue":"save_expense"}]},"renameOutput":true},{"outputKey":"Discount Path","conditions":{"options":{"version":3,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"d3cabdbe-6667-4d7f-aba6-2c3a4e9739df","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.route_path }}","rightValue":"save_supplier_discount"}]},"renameOutput":true},{"outputKey":"Supplier Payment Path","conditions":{"options":{"version":3,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"1da844d2-6c17-4156-acb2-0b2d340c81af","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.route_path }}","rightValue":"save_supplier_payment"}]},"renameOutput":true},{"outputKey":"Supplier Invoice Path","conditions":{"options":{"version":3,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"a44e6a18-e047-41bc-abc6-b9f112bf835e","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.route_path }}","rightValue":"save_supplier_invoice"}]},"renameOutput":true},{"outputKey":"Advance Path","conditions":{"options":{"version":3,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"0c0db7ec-12c0-4dac-a18f-ff70080137e2","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.route_path }}","rightValue":"save_advance"}]},"renameOutput":true},{"outputKey":"Supplier Statement Path","conditions":{"options":{"version":3,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"835c54cc-ad8a-4bb9-967f-c6fad1c8383c","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.route_path }}","rightValue":"=fetch_supplier_statement"}]},"renameOutput":true},{"outputKey":"Fetch Path","conditions":{"options":{"version":3,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"13f0fbf0-8ecd-4399-9a9c-c1717ba90eab","operator":{"type":"string","operation":"contains"},"leftValue":"={{ $json.route_path }}","rightValue":"fetch"}]},"renameOutput":true}]},"options":{},"looseTypeValidation":true},"typeVersion":3.4},{"id":"7d57fcf3-71e8-4762-8af2-b42e2b18f258","name":"Build Odoo Journal Entry","type":"n8n-nodes-base.code","position":[480,560],"parameters":{"jsCode":"const botData = $('Clean AI Output').item.json;\nconst amount = parseFloat(botData.entities.amount);\nconst category = botData.entities.category_or_type;\nconst company = botData.company || \"[DEFAULT_COMPANY_NAME]\"; \n\nconst debitAccountId = $('Find Expense Account ID').item.json.id;\nconst creditAccountId = $('Find Cash Account ID').item.json.id;\n\nconst fullRef = `${category} ${company}`;\nconst debitLabel = category;\nconst creditLabel = `سداد مصروف: ${category}`;\n\nreturn {\n  \"ref\": fullRef,\n  \"move_type\": \"entry\",\n  \"journal_id\": 2, // [TEMPLATE: REPLACE WITH YOUR ODOO JOURNAL ID]\n  \"line_ids\": [\n    [0, 0, { \"account_id\": debitAccountId, \"name\": debitLabel, \"debit\": amount, \"credit\": 0.0 }],\n    [0, 0, { \"account_id\": creditAccountId, \"name\": creditLabel, \"debit\": 0.0, \"credit\": amount }]\n  ]\n};"},"typeVersion":2},{"id":"f953e928-ba2f-40d4-9f20-0d6f085c4ba0","name":"Create Odoo Entry","type":"n8n-nodes-base.odoo","position":[704,560],"parameters":{"resource":"custom","customResource":"account.move","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"journal_id","fieldValue":"={{ $json.journal_id }}"},{"fieldName":"move_type","fieldValue":"={{ $json.move_type }}"},{"fieldName":"line_ids","fieldValue":"={{ $json.line_ids }}"},{"fieldName":"ref","fieldValue":"={{ $json.ref }}"}]}},"typeVersion":1},{"id":"7035e0e0-32f4-4617-a02a-2ceab249f883","name":"Find Partner ID","type":"n8n-nodes-base.odoo","position":[-192,752],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $json.entities.target_name }}","operator":"like","fieldName":"name"}]},"customResource":"res.partner"},"typeVersion":1},{"id":"572ba219-c428-46fc-bdf1-43d5e94b6144","name":"Build Discount Entry","type":"n8n-nodes-base.code","position":[480,752],"parameters":{"jsCode":"const partnerId = $('Find Partner ID').item.json.id;\nconst debitAccountId = $('Find Debit Account ID').item.json.id;\nconst creditAccountId = $('Find Credit Account ID').item.json.id;\n\nconst currencyId = 1; // [TEMPLATE: REPLACE WITH YOUR ODOO CURRENCY ID]\n\nconst aiData = $('Clean AI Output').item.json.entities;\nconst amount = parseFloat(aiData.amount);\nconst label = aiData.label;\n\nconst lines = [\n    [0, 0, { \"account_id\": debitAccountId, \"partner_id\": partnerId, \"name\": label, \"debit\": amount, \"credit\": 0.0, \"currency_id\": currencyId }],\n    [0, 0, { \"account_id\": creditAccountId, \"name\": label, \"debit\": 0.0, \"credit\": amount, \"currency_id\": currencyId }]\n];\nreturn { lines_to_odoo: lines };"},"typeVersion":2},{"id":"cc798d9e-dbd0-45eb-ab82-ccb9631e3f10","name":"Confirm & Post Entry1","type":"n8n-nodes-base.odoo","position":[928,752],"parameters":{"resource":"custom","operation":"update","customResource":"account.move","customResourceId":"={{ $json.id }}","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"state","fieldValue":"posted"}]}},"typeVersion":1},{"id":"7954d235-8f6b-4bcc-b540-de2f55de95f8","name":"Create Discount Entry","type":"n8n-nodes-base.odoo","position":[704,752],"parameters":{"resource":"custom","customResource":"account.move","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"line_ids","fieldValue":"={{ $json.lines_to_odoo }}"},{"fieldName":"ref","fieldValue":"={{ $('Clean AI Output').item.json.entities.label }}"}]}},"typeVersion":1},{"id":"e2a96501-4101-45ab-9a59-5731c767b4e5","name":"Find Debit Account ID","type":"n8n-nodes-base.odoo","position":[32,752],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Route to Expense Path').item.json.entities.debit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"0c98bcf0-c0c4-49ad-9d4d-4038e6fb08d9","name":"Find Credit Account ID","type":"n8n-nodes-base.odoo","position":[256,752],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Route to Expense Path').item.json.entities.credit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"da4ae748-de3f-482f-b6a3-7e9e95da5623","name":"Filter Payment Source","type":"n8n-nodes-base.switch","position":[-864,1040],"parameters":{"rules":{"values":[{"outputKey":"Checks Path","conditions":{"options":{"version":3,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"49b2f04f-1c50-4783-b932-ffefeaf4cba7","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.entities.source }}","rightValue":"شيكات"}]},"renameOutput":true},{"outputKey":"Instant Payment Path","conditions":{"options":{"version":3,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"1028f762-a9bc-4766-b9b8-f2e161fed176","operator":{"type":"string","operation":"notEquals"},"leftValue":"={{ $json.entities.source }}","rightValue":"شيكات"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.4},{"id":"7ac9d563-4b8d-4c5d-bc7f-9cfae4960ac1","name":"Format Check Date","type":"n8n-nodes-base.code","position":[-640,944],"parameters":{"jsCode":"for (const item of $input.all()) {\n  if (item.json.entities && item.json.entities.check_details && item.json.entities.check_details.due_date) {\n    const rawDate = item.json.entities.check_details.due_date; \n    const [day, month, year] = rawDate.split('/');\n    item.json.entities.check_details.formatted_due_date = `${year}-${month}-${day}`; \n  }\n}\nreturn $input.all();"},"typeVersion":2},{"id":"a7b55785-8077-49f2-a854-149c9854081b","name":"Create an event","type":"n8n-nodes-base.googleCalendar","position":[-416,944],"parameters":{"end":"={{ $json.entities.check_details.formatted_due_date }}T10:00:00","start":"={{ $json.entities.check_details.formatted_due_date }}T09:00:00","calendar":{"__rl":true,"mode":"list","value":"user@example.com"},"additionalFields":{"summary":"=استحقاق شيك لمورد: {{ $json.entities.target_name }}","description":"=مبلغ الشيك: {{ $json.entities.amount }} | رقم الشيك: {{ $json.entities.check_details.check_number }}"},"useDefaultReminders":"={{ true }}"},"typeVersion":1.3},{"id":"d746453e-191f-4ae7-b83b-4b058460631f","name":"Find Partner ID2","type":"n8n-nodes-base.odoo","position":[-192,944],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Format Check Date').item.json.entities.target_name }}","operator":"like","fieldName":"name"}]},"customResource":"res.partner"},"typeVersion":1},{"id":"3d8fbdb6-e61f-40bc-9888-f04560651138","name":"Find Debit Account ID1","type":"n8n-nodes-base.odoo","position":[32,944],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Format Check Date').item.json.entities.debit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"72ea3603-d788-4105-b6fd-edc51a3d2a3d","name":"Find Credit Account ID1","type":"n8n-nodes-base.odoo","position":[256,944],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Format Check Date').item.json.entities.credit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"f1af3626-24f7-4d28-b5e5-ddacdad84b4a","name":"Build Journal Lines","type":"n8n-nodes-base.code","position":[480,944],"parameters":{"jsCode":"const payload = $('Format Check Date').item.json.entities;\nconst checkDetails = payload.check_details;\nconst partnerId = $('Find Partner ID2').item.json.id;\nconst debitAccountId = $('Find Debit Account ID1').item.json.id;\nconst creditAccountId = $('Find Credit Account ID1').item.json.id;\n\nconst amount = payload.amount;\nconst checkNumber = checkDetails.check_number;\nconst dueDate = checkDetails.formatted_due_date;\nconst supplierName = payload.target_name;\n\nconst lineLabel = `دفعة بشيك رقم ${checkNumber} تستحق في ${dueDate}`;\nconst currencyId = 74; // [TEMPLATE: REPLACE WITH YOUR ODOO CURRENCY ID]\n\nconst lines = [\n  [0, 0, { \"account_id\": debitAccountId, \"partner_id\": partnerId, \"name\": lineLabel, \"debit\": amount, \"credit\": 0, \"currency_id\": currencyId }],\n  [0, 0, { \"account_id\": creditAccountId, \"name\": lineLabel, \"debit\": 0, \"credit\": amount, \"currency_id\": currencyId }]\n];\n\nreturn { json: { journal_ref: `سداد مورد: ${supplierName} - شيك ${checkNumber}`, lines_to_odoo: lines } };"},"typeVersion":2},{"id":"06ee9e6b-9f04-4f4e-a244-6a7ac8937028","name":"Create Discount Entry1","type":"n8n-nodes-base.odoo","position":[704,944],"parameters":{"resource":"custom","customResource":"account.move","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"line_ids","fieldValue":"={{ $json.lines_to_odoo }}"},{"fieldName":"ref","fieldValue":"={{ $json.journal_ref }}"}]}},"typeVersion":1},{"id":"280fbca2-9609-4c81-ab3a-0ebb214c7ae1","name":"Confirm & Post Entry2","type":"n8n-nodes-base.odoo","position":[928,944],"parameters":{"resource":"custom","operation":"update","customResource":"account.move","customResourceId":"={{ $json.id }}","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"state","fieldValue":"posted"}]}},"typeVersion":1},{"id":"8581cc65-762f-4b68-a9e5-a36f286b2810","name":"Find Partner ID3","type":"n8n-nodes-base.odoo","position":[-192,1136],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $json.entities.target_name }}","operator":"like","fieldName":"name"}]},"customResource":"res.partner"},"typeVersion":1},{"id":"310fb4dc-b00a-4889-97a3-0a493ed4dd7d","name":"Find Debit Account ID2","type":"n8n-nodes-base.odoo","position":[32,1136],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Filter Payment Source').item.json.entities.debit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"019c7dd5-20ce-46ce-ac99-5abe20103bb5","name":"Find Credit Account ID2","type":"n8n-nodes-base.odoo","position":[256,1136],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Filter Payment Source').item.json.entities.credit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"4cd9c072-8710-48be-872b-fc578eabcd9b","name":"Build Instant Entry Lines","type":"n8n-nodes-base.code","position":[480,1136],"parameters":{"jsCode":"const payload = $('Clean AI Output').first().json;\nconst partnerId = $('Find Partner ID3').first().json.id;\nconst debitAccountId = $('Find Debit Account ID2').first().json.id;\nconst creditAccountId = $('Find Credit Account ID2').first().json.id;\n\nconst today = new Date().toISOString().split('T')[0];\nconst lineLabel = `سداد فوري للمورد: ${payload.entities.target_name} بتاريخ ${today}`;\nconst currencyId = 74; // [TEMPLATE: REPLACE WITH YOUR ODOO CURRENCY ID]\n\nconst lines = [\n  [0, 0, { \"account_id\": debitAccountId, \"partner_id\": partnerId, \"name\": lineLabel, \"debit\": payload.entities.amount, \"credit\": 0, \"currency_id\": currencyId }],\n  [0, 0, { \"account_id\": creditAccountId, \"name\": lineLabel, \"debit\": 0, \"credit\": payload.entities.amount, \"currency_id\": currencyId }]\n];\n\nreturn { json: { journal_ref: `سداد فوري: ${payload.entities.target_name}`, entry_date: today, lines_to_odoo: lines } };"},"typeVersion":2},{"id":"b57f1f78-7da6-4976-b2ba-93fc40a0b561","name":"Create Discount Entry2","type":"n8n-nodes-base.odoo","position":[704,1136],"parameters":{"resource":"custom","customResource":"account.move","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"line_ids","fieldValue":"={{ $json.lines_to_odoo }}"},{"fieldName":"ref","fieldValue":"={{ $json.journal_ref }}"}]}},"typeVersion":1},{"id":"58839b88-ab53-4a88-bc22-ea4ab96fe5fa","name":"Confirm & Post Entry3","type":"n8n-nodes-base.odoo","position":[928,1136],"parameters":{"resource":"custom","operation":"update","customResource":"account.move","customResourceId":"={{ $json.id }}","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"state","fieldValue":"posted"}]}},"typeVersion":1},{"id":"b3446b1f-8a7b-49a6-90f9-4f2f9f89861c","name":"Find Partner ID4","type":"n8n-nodes-base.odoo","position":[-192,1328],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $json.entities.target_name.replace(/[أإآ]/g, 'ا').replace(/[ى]/g, 'ي').replace(/[ة]/g, 'ه').trim() }}","operator":"like","fieldName":"name"}]},"customResource":"res.partner"},"typeVersion":1},{"id":"48504344-8f4d-43f1-b2db-5d1f20d18154","name":"Find Debit Account ID3","type":"n8n-nodes-base.odoo","position":[32,1328],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Route to Expense Path').item.json.entities.debit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"77181831-cdfa-40ac-8a55-bf4391d07581","name":"Find Credit Account ID3","type":"n8n-nodes-base.odoo","position":[256,1328],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Route to Expense Path').item.json.entities.credit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"7f98d204-8c65-4a4e-a643-e86352a276db","name":"Build Invoice Entry Lines","type":"n8n-nodes-base.code","position":[480,1328],"parameters":{"jsCode":"const payload = $('Clean AI Output').first().json;\nconst partnerId = $('Find Partner ID4').first().json.id; \nconst debitAccountId = $('Find Debit Account ID3').first().json.id; \nconst creditAccountId = $('Find Credit Account ID3').first().json.id; \n\nconst today = new Date().toISOString().split('T')[0];\nconst lineLabel = `إثبات فاتورة مورد: ${payload.entities.target_name} بتاريخ ${today}`;\nconst currencyId = 74; // [TEMPLATE: REPLACE WITH YOUR ODOO CURRENCY ID]\n\nconst lines = [\n  [0, 0, { \"account_id\": debitAccountId, \"name\": lineLabel, \"debit\": payload.entities.amount, \"credit\": 0, \"currency_id\": currencyId }],\n  [0, 0, { \"account_id\": creditAccountId, \"partner_id\": partnerId, \"name\": lineLabel, \"debit\": 0, \"credit\": payload.entities.amount, \"currency_id\": currencyId }]\n];\n\nreturn { json: { journal_ref: `فاتورة: ${payload.entities.target_name}`, entry_date: today, lines_to_odoo: lines } };"},"typeVersion":2},{"id":"a168aa30-2e4e-4c84-a9ab-2f9d9a6efe62","name":"Create Discount Entry3","type":"n8n-nodes-base.odoo","position":[704,1328],"parameters":{"resource":"custom","customResource":"account.move","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"line_ids","fieldValue":"={{ $json.lines_to_odoo }}"},{"fieldName":"ref","fieldValue":"={{ $json.journal_ref }}"}]}},"typeVersion":1},{"id":"45fb5210-c6b2-420c-9f5c-71535305762d","name":"Confirm & Post Entry4","type":"n8n-nodes-base.odoo","position":[928,1328],"parameters":{"resource":"custom","operation":"update","customResource":"account.move","customResourceId":"={{ $json.id }}","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"state","fieldValue":"posted"}]}},"typeVersion":1},{"id":"19aa1c72-87f3-4759-a164-999f3a04ac77","name":"Find Partner ID5","type":"n8n-nodes-base.odoo","position":[-192,1520],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $json.entities.target_name.replace(/[أإآ]/g, 'ا').replace(/[ى]/g, 'ي').replace(/[ة]/g, 'ه').trim() }}","operator":"like","fieldName":"name"}]},"customResource":"res.partner"},"typeVersion":1},{"id":"3a4379cd-752d-4ea7-bffb-5806237c36ca","name":"Find Debit Account ID4","type":"n8n-nodes-base.odoo","position":[32,1520],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Route to Expense Path').item.json.entities.debit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"2148de06-b201-496f-b1b7-062b422c486b","name":"Find Credit Account ID4","type":"n8n-nodes-base.odoo","position":[256,1520],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Route to Expense Path').item.json.entities.credit_code }}","fieldName":"code"}]},"customResource":"account.account"},"typeVersion":1},{"id":"8925d278-7e4c-4602-9c1b-2092a91dbd83","name":"Build Advance Entry Lines","type":"n8n-nodes-base.code","position":[480,1520],"parameters":{"jsCode":"const payload = $('Clean AI Output').first().json;\nconst partnerId = $('Find Partner ID5').first().json.id; \nconst debitAccountId = $('Find Debit Account ID4').first().json.id; \nconst creditAccountId = $('Find Credit Account ID4').first().json.id; \n\nconst today = new Date().toISOString().split('T')[0];\nconst lineLabel = `سلفة للموظف: ${payload.entities.target_name} بتاريخ ${today}`;\nconst currencyId = 74; // [TEMPLATE: REPLACE WITH YOUR ODOO CURRENCY ID]\n\nconst lines = [\n  [0, 0, { \"account_id\": debitAccountId, \"partner_id\": partnerId, \"name\": lineLabel, \"debit\": payload.entities.amount, \"credit\": 0, \"currency_id\": currencyId }],\n  [0, 0, { \"account_id\": creditAccountId, \"name\": lineLabel, \"debit\": 0, \"credit\": payload.entities.amount, \"currency_id\": currencyId }]\n];\n\nreturn { json: { journal_ref: `سلفة: ${payload.entities.target_name}`, entry_date: today, lines_to_odoo: lines } };"},"typeVersion":2},{"id":"3417ebbb-7ada-437f-b934-e0740f393daa","name":"Create Discount Entry4","type":"n8n-nodes-base.odoo","position":[704,1520],"parameters":{"resource":"custom","customResource":"account.move","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"line_ids","fieldValue":"={{ $json.lines_to_odoo }}"},{"fieldName":"ref","fieldValue":"={{ $json.journal_ref }}"}]}},"typeVersion":1},{"id":"15e17889-5553-47e6-a40c-44a4a42614a1","name":"Confirm & Post Entry5","type":"n8n-nodes-base.odoo","position":[928,1520],"parameters":{"resource":"custom","operation":"update","customResource":"account.move","customResourceId":"={{ $json.id }}","fieldsToCreateOrUpdate":{"fields":[{"fieldName":"state","fieldValue":"posted"}]}},"typeVersion":1},{"id":"6199887a-1680-429a-8744-69a927c06d90","name":"Fetch Safe/Bank Move Lines","type":"n8n-nodes-base.odoo","position":[960,1840],"parameters":{"limit":"={{ 0 }}","options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $('Route to Expense Path').item.json.entities.credit_code }}","fieldName":"account_code"},{"value":"={{ $json.startDate }}","fieldName":"date"}]},"customResource":"account.move.line"},"typeVersion":1,"alwaysOutputData":true},{"id":"caed4b1b-6606-407e-834f-cdab1a9cdc63","name":"Date Resolver","type":"n8n-nodes-base.code","position":[736,1840],"parameters":{"jsCode":"const input = $input.first().json;\nconst userMessage = input.user_message || \"\";\nconst now = new Date();\nlet startDate, endDate, displayName;\n\nif (userMessage.includes(\"شهر\") || userMessage.includes(\"الشهر\")) {\n  startDate = new Date(now.getFullYear(), now.getMonth(), 1).toISOString().split('T')[0];\n  endDate = now.toISOString().split('T')[0];\n  displayName = \"خلال شهر \" + (now.getMonth() + 1);\n} else if (userMessage.includes(\"امبارح\")) {\n  const yesterday = new Date(now);\n  yesterday.setDate(now.getDate() - 1);\n  startDate = yesterday.toISOString().split('T')[0];\n  endDate = startDate;\n  displayName = \"امبارح\";\n} else {\n  startDate = now.toISOString().split('T')[0];\n  endDate = startDate;\n  displayName = \"النهاردة\";\n}\n\nreturn { startDate, endDate, display_name: displayName };"},"typeVersion":2},{"id":"e35ee0d5-cf8c-4d9b-954a-e46c8fe222fc","name":"Build Final Report","type":"n8n-nodes-base.code","position":[1168,1840],"parameters":{"jsCode":"const items = $input.all();\nconst aiData = $('Clean AI Output').first().json.entities || {};\nconst dateData = $('Date Resolver').first().json || {};\n\nlet totalDebit = 0; \nlet totalCredit = 0; \nlet details = \"\";\n\nlet accountName = aiData.source || aiData.category_or_type || \"الحساب\";\nlet displayDate = dateData.display_name || \"الفترة المحددة\";\nlet actualDate = dateData.startDate || dateData.resolved_date || \"\";\n\nif (items.length > 0 && items[0].json && items[0].json.account_id) {\n  accountName = items[0].json.account_id[1]; \n  for (const item of items) {\n    if (!item.json.id) continue;\n    const debit = item.json.debit || 0;\n    const credit = item.json.credit || 0;\n    const ref = item.json.ref || item.json.name || \"بدون وصف\";\n    \n    totalDebit += debit;\n    totalCredit += credit;\n\n    if (debit > 0) details += `• مدين/وارد 🟢: ${debit.toLocaleString()} ج ⬅️ (${ref})\\n`;\n    if (credit > 0) details += `• دائن/منصرف 🔴: ${credit.toLocaleString()} ج ⬅️ (${ref})\\n`;\n  }\n}\n\nlet report = `📊 تقرير حساب: ${accountName}\\n📅 لـ (${displayDate} - ${actualDate}):\\n`;\nreport += `--------------------------\\n`;\n\nif (details) {\n    report += details;\n    report += `--------------------------\\n`;\n    if (accountName.includes(\"شيكات\") || accountName.includes(\"خزين\") || accountName.includes(\"كاش\")) {\n        report += `💰 إجمالي الوارد (دخل): ${totalDebit.toLocaleString()} جنيه\\n`;\n        report += `💸 إجمالي المنصرف (خرج): ${totalCredit.toLocaleString()} جنيه\\n`;\n        report += `⚖️ صافي الحركة: ${(totalDebit - totalCredit).toLocaleString()} جنيه\\n`;\n    } else {\n        report += `💸 إجمالي المصروف: ${totalDebit.toLocaleString()} جنيه\\n`;\n        if (totalCredit > 0) report += `🔄 إجمالي المرتجعات: ${totalCredit.toLocaleString()} جنيه\\n`;\n    }\n} else {\n    report += `⚠️ مفيش أي حركات اتسجلت في الفترة دي.\\n`;\n}\n\nreport += `--------------------------\\n`;\nreport += `💁‍♀️ النظام: الحسبة ظبطت، التقرير معاك!`;\n\nreturn { json: { report_text: report } };"},"typeVersion":2},{"id":"37d2638c-d712-46cf-af4d-a4c7a765fee0","name":"Respond to Webhook","type":"n8n-nodes-base.respondToWebhook","position":[1392,1840],"parameters":{"options":{},"respondWith":"json","responseBody":"={{ { \"reply\": $json.report_text } }}"},"typeVersion":1.5},{"id":"b8abee07-052b-4cd6-b2d1-1b5cd7968f62","name":"Find Supplier ID","type":"n8n-nodes-base.odoo","position":[736,2032],"parameters":{"limit":1,"options":{},"resource":"custom","operation":"getAll","filterRequest":{"filter":[{"value":"={{ $json.entities.target_name.replace(/[أإآ]/g, 'ا').replace(/[ى]/g, 'ي').replace(/[ة]/g, 'ه').trim() }}","operator":"like","fieldName":"name"}]},"customResource":"res.partner"},"typeVersion":1},{"id":"a4e6111d-55f9-43ac-81ca-268b19025e0a","name":"Get many items","type":"n8n-nodes-base.odoo","position":[960,2032],"parameters":{"options":{},"resource":"custom","operation":"getAll","returnAll":true,"filterRequest":{"filter":[{"value":"={{ $json.id }}","fieldName":"partner_id"},{"value":"posted","fieldName":"parent_state"}]},"customResource":"account.move.line"},"typeVersion":1,"alwaysOutputData":true},{"id":"851c295c-3e2e-4549-96b0-61299590bf20","name":"Calculate Supplier Balance","type":"n8n-nodes-base.code","position":[1168,2032],"parameters":{"jsCode":"const items = $input.all();\nconst supplierName = $('Clean AI Output').first().json.entities.target_name;\n\nlet totalDebit = 0; \nlet totalCredit = 0; \n\nitems.sort((a, b) => new Date(b.json.date) - new Date(a.json.date));\n\nlet details = \"\";\nlet counter = 0;\n\nfor (const item of items) {\n  const debit = item.json.debit || 0;\n  const credit = item.json.credit || 0;\n  const ref = item.json.name || item.json.ref || \"بدون وصف\";\n  \n  totalDebit += debit;\n  totalCredit += credit;\n\n  if (counter < 10) {\n    if (credit > 0) details += `🔴 فاتورة/رصيد (+${credit.toLocaleString()} ج) ⬅️ ${ref}\\n`;\n    else if (debit > 0) details += `🟢 سداد/خصم (-${debit.toLocaleString()} ج) ⬅️ ${ref}\\n`;\n    counter++;\n  }\n}\n\nconst balance = totalCredit - totalDebit;\nlet balanceText = \"\";\n\nif (balance > 0) balanceText = `⚠️ المورد ليه في ذمتنا: ${balance.toLocaleString()} جنيه`;\nelse if (balance < 0) balanceText = `✅ لينا عند المورد: ${Math.abs(balance).toLocaleString()} جنيه`;\nelse balanceText = `👌 الحساب مصفر (خالصين)`;\n\nlet report = `🧾 كشف حساب مجمع: ${supplierName}\\n`;\nreport += `--------------------------\\n`;\nreport += `أحدث الحركات:\\n${details}`;\nif (items.length > 10) report += `... (تم إخفاء باقي الحركات القديمة)\\n`;\nreport += `--------------------------\\n`;\nreport += `إجمالي اللي نزل حسابه: ${totalCredit.toLocaleString()} ج\\n`;\nreport += `إجمالي اللي إتدفعـلـه: ${totalDebit.toLocaleString()} ج\\n`;\nreport += `--------------------------\\n`;\nreport += `💰 الصافي النهائي:\\n${balanceText}\\n`;\nreport += `--------------------------\\n`;\nreport += `💁‍♀️ النظام: التقرير متقفل، أأمرني باللي بعده!`;\n\nreturn { json: { report_text: report } };"},"typeVersion":2},{"id":"f49324c9-3ab3-487c-9618-09ea2a980020","name":"Success Message","type":"n8n-nodes-base.code","position":[1152,1040],"parameters":{"jsCode":"const aiData = $('Clean AI Output').first().json.entities;\nconst amount = aiData.amount || 0;\nconst target = aiData.target_name || aiData.category_or_type || \"العملية\";\n\nlet report = `💁‍♀️ النظام: كله تمام يا ريس! ✅\\n`;\nreport += `تم إثبات وتسجيل (${target}) بمبلغ ${amount.toLocaleString()} جنيه في الدفاتر بنجاح!`;\n\nreturn { json: { report_text: report } };"},"typeVersion":2},{"id":"e30a0644-0b16-43b9-ad5b-533bf399c807","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-3280,1120],"parameters":{"width":1184,"height":432,"content":"### How it works\nThis workflow acts as an AI-powered financial assistant, connecting chat platforms (like Telegram or Botpress) to your Odoo ERP. \n\nWhen a user sends a natural language message in Arabic (e.g., \"I spent 2000 on office supplies\"), an OpenAI LangChain agent extracts the intent, amounts, dates, and account categories. The workflow then routes the request to either post a new double-entry journal record in Odoo (for expenses, supplier payments, or employee advances) or fetch real-time account balances to send a formatted Arabic report back to the chat.\n\n### Setup steps\n1. **Credentials:** Connect your Odoo, OpenAI, and Google Calendar credentials.\n2. **Webhook:** Add the Webhook URL to your Telegram/Botpress bot setup.\n3. **Prompt Mapping:** Open the \"AI Financial Agent\" node and update the `# ACCOUNT MAPPING` section with your specific Odoo Chart of Accounts codes (e.g., replace `[EXPENSE_1_CODE]` with your actual Odoo account code).\n4. **Code Nodes:** Open the \"Build [X] Entry\" Code nodes and replace the placeholder `journal_id` and `currency_id` with your Odoo internal IDs.\n\n### Customization tips\nYou can easily expand the `Route to Expense Path` Switch node to handle other operations, such as creating customer invoices or logging petty cash transfers."},"typeVersion":1},{"id":"851894c1-1675-4c91-829f-705ab0d597dd","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-2000,1168],"parameters":{"color":7,"width":720,"height":512,"content":"## 1. Receive & Classify Intent\nReceives the chat message and uses an AI agent to extract the financial operation, amounts, dates, and target accounts into a clean JSON format."},"typeVersion":1},{"id":"843171a8-7bff-4999-8784-7aacb06ea19b","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-1216,1072],"parameters":{"color":7,"width":288,"height":304,"content":"## 2. Route Operation\nDirects the workflow down the correct path based on whether the user is logging an expense, paying a supplier, or requesting a balance report."},"typeVersion":1},{"id":"e28f9027-4299-4081-84ca-b1800e8c75f3","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-224,448],"parameters":{"color":7,"width":608,"height":1280,"content":"## 3. Odoo Data Lookups\nSearches Odoo to find the internal internal `account_id` and `partner_id` required to build accurate journal entries."},"typeVersion":1},{"id":"ae32833a-f179-4156-84ea-d6fc42a4e3a0","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[416,352],"parameters":{"color":7,"height":1376,"content":"## 4. Build & Post Entries\nConstructs the double-entry accounting arrays (debits and credits) and automatically posts the confirmed journal entries into Odoo."},"typeVersion":1},{"id":"b146e4fe-a168-4549-8d5f-91006809df52","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-720,848],"parameters":{"color":7,"width":480,"height":240,"content":"## 5. Schedule Checks\nParses future due dates for physical check payments and creates a Google Calendar event reminder."},"typeVersion":1},{"id":"918285b8-5950-44e2-a439-5569962c8db0","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[912,1744],"parameters":{"color":7,"width":640,"height":416,"content":"## 6. Reports & Chat Response\nCalculates net balances from Odoo ledger lines, generates a formatted Arabic summary, and sends the response back to the user via Webhook."},"typeVersion":1}],"active":false,"pinData":{},"settings":{"availableInMCP":false,"executionOrder":"v1"},"versionId":"ef929821-22a6-4dd1-87f6-d09f47581fb4","connections":{"Date Resolver":{"main":[[{"node":"Fetch Safe/Bank Move Lines","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Financial Agent","type":"ai_memory","index":0}]]},"Get many items":{"main":[[{"node":"Calculate Supplier Balance","type":"main","index":0}]]},"Clean AI Output":{"main":[[{"node":"Route to Expense Path","type":"main","index":0}]]},"Create an event":{"main":[[{"node":"Find Partner ID2","type":"main","index":0}]]},"Find Partner ID":{"main":[[{"node":"Find Debit Account ID","type":"main","index":0}]]},"Success Message":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"Find Partner ID2":{"main":[[{"node":"Find Debit Account ID1","type":"main","index":0}]]},"Find Partner ID3":{"main":[[{"node":"Find Debit Account ID2","type":"main","index":0}]]},"Find Partner ID4":{"main":[[{"node":"Find Debit Account ID3","type":"main","index":0}]]},"Find Partner ID5":{"main":[[{"node":"Find Debit Account ID4","type":"main","index":0}]]},"Find Supplier ID":{"main":[[{"node":"Get many items","type":"main","index":0}]]},"Bot Data Receiver":{"main":[[{"node":"AI Financial Agent","type":"main","index":0}]]},"Create Odoo Entry":{"main":[[{"node":"Confirm & Post Entry","type":"main","index":0}]]},"Format Check Date":{"main":[[{"node":"Create an event","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Financial Agent","type":"ai_languageModel","index":0}]]},"AI Financial Agent":{"main":[[{"node":"Clean AI Output","type":"main","index":0}]]},"Build Final Report":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"Build Journal Lines":{"main":[[{"node":"Create Discount Entry1","type":"main","index":0}]]},"Build Discount Entry":{"main":[[{"node":"Create Discount Entry","type":"main","index":0}]]},"Confirm & Post Entry":{"main":[[{"node":"Success Message","type":"main","index":0}]]},"Find Cash Account ID":{"main":[[{"node":"Build Odoo Journal Entry","type":"main","index":0}]]},"Confirm & Post Entry1":{"main":[[{"node":"Success Message","type":"main","index":0}]]},"Confirm & Post Entry2":{"main":[[{"node":"Success Message","type":"main","index":0}]]},"Confirm & Post Entry3":{"main":[[{"node":"Success Message","type":"main","index":0}]]},"Confirm & Post Entry4":{"main":[[{"node":"Success Message","type":"main","index":0}]]},"Confirm & Post Entry5":{"main":[[{"node":"Success Message","type":"main","index":0}]]},"Create Discount Entry":{"main":[[{"node":"Confirm & Post Entry1","type":"main","index":0}]]},"Filter Payment Source":{"main":[[{"node":"Format Check Date","type":"main","index":0}],[{"node":"Find Partner ID3","type":"main","index":0}]]},"Find Debit Account ID":{"main":[[{"node":"Find Credit Account ID","type":"main","index":0}]]},"Route to Expense Path":{"main":[[{"node":"Find Expense Account ID","type":"main","index":0}],[{"node":"Find Partner ID","type":"main","index":0}],[{"node":"Filter Payment Source","type":"main","index":0}],[{"node":"Find Partner ID4","type":"main","index":0}],[{"node":"Find Partner ID5","type":"main","index":0}],[{"node":"Find Supplier ID","type":"main","index":0}],[{"node":"Date Resolver","type":"main","index":0}]]},"Create Discount Entry1":{"main":[[{"node":"Confirm & Post Entry2","type":"main","index":0}]]},"Create Discount Entry2":{"main":[[{"node":"Confirm & Post Entry3","type":"main","index":0}]]},"Create Discount Entry3":{"main":[[{"node":"Confirm & Post Entry4","type":"main","index":0}]]},"Create Discount Entry4":{"main":[[{"node":"Confirm & Post Entry5","type":"main","index":0}]]},"Find Credit Account ID":{"main":[[{"node":"Build Discount Entry","type":"main","index":0}]]},"Find Debit Account ID1":{"main":[[{"node":"Find Credit Account ID1","type":"main","index":0}]]},"Find Debit Account ID2":{"main":[[{"node":"Find Credit Account ID2","type":"main","index":0}]]},"Find Debit Account ID3":{"main":[[{"node":"Find Credit Account ID3","type":"main","index":0}]]},"Find Debit Account ID4":{"main":[[{"node":"Find Credit Account ID4","type":"main","index":0}]]},"Find Credit Account ID1":{"main":[[{"node":"Build Journal Lines","type":"main","index":0}]]},"Find Credit Account ID2":{"main":[[{"node":"Build Instant Entry Lines","type":"main","index":0}]]},"Find Credit Account ID3":{"main":[[{"node":"Build Invoice Entry Lines","type":"main","index":0}]]},"Find Credit Account ID4":{"main":[[{"node":"Build Advance Entry Lines","type":"main","index":0}]]},"Find Expense Account ID":{"main":[[{"node":"Find Cash Account ID","type":"main","index":0}]]},"Build Odoo Journal Entry":{"main":[[{"node":"Create Odoo Entry","type":"main","index":0}]]},"Build Advance Entry Lines":{"main":[[{"node":"Create Discount Entry4","type":"main","index":0}]]},"Build Instant Entry Lines":{"main":[[{"node":"Create Discount Entry2","type":"main","index":0}]]},"Build Invoice Entry Lines":{"main":[[{"node":"Create Discount Entry3","type":"main","index":0}]]},"Calculate Supplier Balance":{"main":[[{"node":"Respond to Webhook","type":"main","index":0}]]},"Fetch Safe/Bank Move Lines":{"main":[[{"node":"Build Final Report","type":"main","index":0}]]}}},"lastUpdatedBy":1,"workflowInfo":{"nodeCount":59,"nodeTypes":{"n8n-nodes-base.code":{"count":12},"n8n-nodes-base.odoo":{"count":32},"n8n-nodes-base.switch":{"count":2},"n8n-nodes-base.webhook":{"count":1},"n8n-nodes-base.stickyNote":{"count":7},"n8n-nodes-base.googleCalendar":{"count":1},"@n8n/n8n-nodes-langchain.agent":{"count":1},"n8n-nodes-base.respondToWebhook":{"count":1},"@n8n/n8n-nodes-langchain.lmChatOpenAi":{"count":1},"@n8n/n8n-nodes-langchain.memoryBufferWindow":{"count":1}}},"status":"published","readyToDemo":null,"user":{"name":"khaled yasser","username":"khaledyasser01","bio":"Odoo ERP Specialist (5+ Years) | MS Outlook & Microsoft Expert (9+ Years) | Workflow Automation (n8n) | Ai Automation","verified":true,"links":["https://www.linkedin.com/in/khaledyasser01/?skipRedirect=true"],"avatar":"https://gravatar.com/avatar/b745dbe81ba146f51ad79e3500a918ab7ad1f5aa6fafc3c3a01a987fe7e1bfaa?r=pg&d=retro&size=200"},"nodes":[{"id":47,"icon":"file:webhook.svg","name":"n8n-nodes-base.webhook","codex":{"data":{"alias":["HTTP","API","Build","WH"],"resources":{"generic":[{"url":"https://n8n.io/blog/learn-how-to-automatically-cross-post-your-content-with-n8n/","icon":"✍️","label":"Learn how to automatically cross-post your content with n8n"},{"url":"https://n8n.io/blog/running-n8n-on-ships-an-interview-with-maranics/","icon":"🛳","label":"Running n8n on ships: An interview with Maranics"},{"url":"https://n8n.io/blog/how-to-build-a-low-code-self-hosted-url-shortener/","icon":"🔗","label":"How to build a low-code, self-hosted URL shortener in 3 steps"},{"url":"https://n8n.io/blog/what-are-apis-how-to-use-them-with-no-code/","icon":" 🪢","label":"What are APIs and how to use them with no code"},{"url":"https://n8n.io/blog/5-tasks-you-can-automate-with-notion-api/","icon":"⚡️","label":"5 tasks you can automate with the new Notion API "},{"url":"https://n8n.io/blog/how-a-digital-strategist-uses-n8n-for-online-marketing/","icon":"💻","label":"How a digital strategist uses n8n for online marketing"},{"url":"https://n8n.io/blog/the-ultimate-guide-to-automate-your-video-collaboration-with-whereby-mattermost-and-n8n/","icon":"📹","label":"The ultimate guide to automate your video collaboration with Whereby, Mattermost, and n8n"},{"url":"https://n8n.io/blog/how-to-automatically-give-kudos-to-contributors-with-github-slack-and-n8n/","icon":"👏","label":"How to automatically give kudos to contributors with GitHub, Slack, and n8n"},{"url":"https://n8n.io/blog/5-workflow-automations-for-mattermost-that-we-love-at-n8n/","icon":"🤖","label":"5 workflow automations for Mattermost that we love at n8n"},{"url":"https://n8n.io/blog/why-this-product-manager-loves-workflow-automation-with-n8n/","icon":"🧠","label":"Why this Product Manager loves workflow automation with n8n"},{"url":"https://n8n.io/blog/creating-custom-incident-response-workflows-with-n8n/","label":"How to automate every step of an incident response workflow"},{"url":"https://n8n.io/blog/learn-to-build-powerful-api-endpoints-using-webhooks/","icon":"🧰","label":"Learn to Build Powerful API Endpoints Using Webhooks"},{"url":"https://n8n.io/blog/learn-how-to-use-webhooks-with-mattermost-slash-commands/","icon":"🦄","label":"Learn how to use webhooks with Mattermost slash commands"},{"url":"https://n8n.io/blog/how-goomer-automated-their-operations-with-over-200-n8n-workflows/","icon":"🛵","label":"How Goomer automated their operations with over 200 n8n workflows"}],"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook/"}]},"categories":["Development","Core Nodes"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"Core Nodes":["Helpers"]}}},"group":"[\"trigger\"]","defaults":{"name":"Webhook"},"iconData":{"type":"file","fileBuffer":"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCI+PHBhdGggZmlsbD0iIzM3NDc0ZiIgZD0iTTM1IDM3Yy0yLjIgMC00LTEuOC00LTRzMS44LTQgNC00IDQgMS44IDQgNC0xLjggNC00IDQiLz48cGF0aCBmaWxsPSIjMzc0NzRmIiBkPSJNMzUgNDNjLTMgMC01LjktMS40LTcuOC0zLjdsMy4xLTIuNWMxLjEgMS40IDIuOSAyLjMgNC43IDIuMyAzLjMgMCA2LTIuNyA2LTZzLTIuNy02LTYtNmMtMSAwLTIgLjMtMi45LjdsLTEuNyAxTDIzLjMgMTZsMy41LTEuOSA1LjMgOS40YzEtLjMgMi0uNSAzLS41IDUuNSAwIDEwIDQuNSAxMCAxMFM0MC41IDQzIDM1IDQzIi8+PHBhdGggZmlsbD0iIzM3NDc0ZiIgZD0iTTE0IDQzQzguNSA0MyA0IDM4LjUgNCAzM2MwLTQuNiAzLjEtOC41IDcuNS05LjdsMSAzLjlDOS45IDI3LjkgOCAzMC4zIDggMzNjMCAzLjMgMi43IDYgNiA2czYtMi43IDYtNnYtMmgxNXY0SDIzLjhjLS45IDQuNi01IDgtOS44IDgiLz48cGF0aCBmaWxsPSIjZTkxZTYzIiBkPSJNMTQgMzdjLTIuMiAwLTQtMS44LTQtNHMxLjgtNCA0LTQgNCAxLjggNCA0LTEuOCA0LTQgNCIvPjxwYXRoIGZpbGw9IiMzNzQ3NGYiIGQ9Ik0yNSAxOWMtMi4yIDAtNC0xLjgtNC00czEuOC00IDQtNCA0IDEuOCA0IDQtMS44IDQtNCA0Ii8+PHBhdGggZmlsbD0iI2U5MWU2MyIgZD0ibTE1LjcgMzQtMy40LTIgNS45LTkuN2MtMi0xLjktMy4yLTQuNS0zLjItNy4zIDAtNS41IDQuNS0xMCAxMC0xMHMxMCA0LjUgMTAgMTBjMCAuOS0uMSAxLjctLjMgMi41bC0zLjktMWMuMS0uNS4yLTEgLjItMS41IDAtMy4zLTIuNy02LTYtNnMtNiAyLjctNiA2YzAgMi4xIDEuMSA0IDIuOSA1LjFsMS43IDF6Ii8+PC9zdmc+"},"displayName":"Webhook","typeVersion":2,"nodeCategories":[{"id":5,"name":"Development"},{"id":9,"name":"Core Nodes"}]},{"id":112,"icon":"fa:map-signs","name":"n8n-nodes-base.switch","codex":{"data":{"alias":["Router","If","Path","Filter","Condition","Logic","Branch","Case"],"resources":{"generic":[{"url":"https://n8n.io/blog/2021-the-year-to-automate-the-new-you-with-n8n/","icon":"☀️","label":"2021: The Year to Automate the New You with n8n"},{"url":"https://n8n.io/blog/how-to-get-started-with-crm-automation-and-no-code-workflow-ideas/","icon":"👥","label":"How to get started with CRM automation (with 3 no-code workflow ideas"},{"url":"https://n8n.io/blog/build-your-own-virtual-assistant-with-n8n-a-step-by-step-guide/","icon":"👦","label":"Build your own virtual assistant with n8n: A step by step guide"},{"url":"https://n8n.io/blog/automation-for-maintainers-of-open-source-projects/","icon":"🏷️","label":"How to automatically manage contributions to open-source projects"}],"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.switch/"}]},"categories":["Core Nodes"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"Core Nodes":["Flow"]}}},"group":"[\"transform\"]","defaults":{"name":"Switch","color":"#506000"},"iconData":{"icon":"map-signs","type":"icon"},"displayName":"Switch","typeVersion":3,"nodeCategories":[{"id":9,"name":"Core Nodes"}]},{"id":317,"icon":"file:googleCalendar.svg","name":"n8n-nodes-base.googleCalendar","codex":{"data":{"resources":{"generic":[{"url":"https://n8n.io/blog/how-to-host-virtual-coffee-breaks-with-n8n/","icon":"☕️","label":"How to host virtual coffee breaks with n8n"},{"url":"https://n8n.io/blog/supercharging-your-conference-registration-process-with-n8n/","icon":"🎫","label":"Supercharging your conference registration process with n8n"},{"url":"https://n8n.io/blog/automate-google-apps-for-productivity/","icon":"💡","label":"15 Google apps you can combine and automate to increase productivity"},{"url":"https://n8n.io/blog/your-business-doesnt-need-you-to-operate/","icon":" 🖥️","label":"Hey founders! Your business doesn't need you to operate"},{"url":"https://n8n.io/blog/5-workflow-automations-for-mattermost-that-we-love-at-n8n/","icon":"🤖","label":"5 workflow automation for Mattermost that we love at n8n"},{"url":"https://n8n.io/blog/tracking-time-spent-in-meetings-with-google-calendar-twilio-and-n8n/","icon":"🗓","label":"Tracking Time Spent in Meetings With Google Calendar, Twilio, and n8n"}],"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googlecalendar/"}],"credentialDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/credentials/google/oauth-single-service/"}]},"categories":["Productivity"],"nodeVersion":"1.0","codexVersion":"1.0"}},"group":"[\"input\"]","defaults":{"name":"Google Calendar"},"iconData":{"type":"file","fileBuffer":"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiB2aWV3Qm94PSIwIDAgODEgODIiPjx1c2UgeGxpbms6aHJlZj0iI2EiIHg9Ii41IiB5PSIuNSIvPjxzeW1ib2wgaWQ9ImEiIG92ZXJmbG93PSJ2aXNpYmxlIj48ZyBmaWxsLXJ1bGU9Im5vbnplcm8iIHN0cm9rZT0ibm9uZSI+PHBhdGggZD0iTTYxLjA1MiAxOC45NDdIMTguOTQ3djQyLjEwNWg0Mi4xMDV6Ii8+PHBhdGggZmlsbD0iI2VhNDMzNS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TQ4Ljg2LTEuMTA2IDEuMzAxLTEuMzc5IDIuMTExbC0zLjYxNi0xLjUwNWMuNDc5LTEuMzU4IDEuMzU4LTIuNTU4IDIuNjQ3LTMuNTk1czIuOTM3LTEuNTU4IDQuOTM3LTEuNTU4cTIuMjItLjAwMiAzLjk4OS44NThjMS43NjkuODYgMi4xMDUgMS4zNjggMi43NzQgMi4zNzlzMSAyLjE1MyAxIDMuNDE2cTAgMS45MzItLjkzMiAzLjI3NGMtLjkzMiAxLjM0Mi0xLjM4NCAxLjU3OS0yLjI4OSAyLjA1OHYuMjE2YTYuOTUgNi45NSAwIDAgMSAyLjkzNyAyLjI4OXExLjE0NiAxLjUzOCAxLjE0NyAzLjY4NGMuMDAxIDIuMTQ2LS4zNjMgMi43MTEtMS4wODkgMy44MzJzLTEuNzMyIDIuMDA1LTMuMDA1IDIuNjQ3Yy0xLjI3OS42NDItMi43MTYuOTY4LTQuMzExLjk2OC0xLjg0Ny4wMDUtMy41NTMtLjUyNi01LjEyNi0xLjU4OXptMjIuNDM3LTE4LjEyNi00LjAxIDIuOS0yLjAwNS0zLjA0MiA3LjE5NS01LjE4OWgyLjc1OHYyNC40NzloLTMuOTM3VjMzLjQ4NHoiLz48L2c+PC9zeW1ib2w+PC9zdmc+"},"displayName":"Google Calendar","typeVersion":1,"nodeCategories":[{"id":4,"name":"Productivity"}]},{"id":535,"icon":"file:webhook.svg","name":"n8n-nodes-base.respondToWebhook","codex":{"data":{"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.respondtowebhook/"}]},"categories":["Core Nodes","Utility"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"Core Nodes":["Helpers"]}}},"group":"[\"transform\"]","defaults":{"name":"Respond to Webhook"},"iconData":{"type":"file","fileBuffer":"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PS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sMS43IDF6Ii8+PC9zdmc+"},"displayName":"Respond to Webhook","typeVersion":2,"nodeCategories":[{"id":7,"name":"Utility"},{"id":9,"name":"Core Nodes"}]},{"id":559,"icon":"file:odoo.svg","name":"n8n-nodes-base.odoo","codex":{"data":{"alias":["ERP"],"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.odoo/"}],"credentialDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/credentials/odoo/"}]},"categories":["Data & Storage"],"nodeVersion":"1.0","codexVersion":"1.0"}},"group":"[\"transform\"]","defaults":{"name":"Odoo"},"iconData":{"type":"file","fileBuffer":"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNTAiIGhlaWdodD0iMTUwIj48Y2lyY2xlIGN4PSI3NSIgY3k9Ijc1IiByPSI3Mi40IiBmaWxsPSIjOWM1Nzg5Ii8+PGNpcmNsZSBjeD0iNzUiIGN5PSI3NSIgcj0iNDIuNyIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg=="},"displayName":"Odoo","typeVersion":1,"nodeCategories":[{"id":3,"name":"Data & Storage"}]},{"id":565,"icon":"fa:sticky-note","name":"n8n-nodes-base.stickyNote","codex":{"data":{"alias":["Comments","Notes","Sticky"],"categories":["Core Nodes"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"Core Nodes":["Helpers"]}}},"group":"[\"input\"]","defaults":{"name":"Sticky Note","color":"#FFD233"},"iconData":{"icon":"sticky-note","type":"icon"},"displayName":"Sticky Note","typeVersion":1,"nodeCategories":[{"id":9,"name":"Core Nodes"}]},{"id":834,"icon":"file:code.svg","name":"n8n-nodes-base.code","codex":{"data":{"alias":["cpde","Javascript","JS","Python","Script","Custom Code","Function"],"details":"The Code node allows you to execute JavaScript in your workflow.","resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code/"}]},"categories":["Development","Core Nodes"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"Core Nodes":["Helpers","Data Transformation"]}}},"group":"[\"transform\"]","defaults":{"name":"Code"},"iconData":{"type":"file","fileBuffer":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxMiIgdmlld0JveD0iMCAwIDUxMiA1MTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMF8xMTcxXzQ0MSkiPgo8cGF0aCBkPSJNMTcwLjI4MyA0OEgxOTYuNUMyMDMuMTI3IDQ4IDIwOC41IDQyLjYyNzQgMjA4LjUgMzZWMTJDMjA4LjUgNS4zNzI1OCAyMDMuMTI3IDAgMTk2LjUgMEgxNzAuMjgzQzEyNi4xIDAgOTAuMjgzIDM1LjgxNzIgOTAuMjgzIDgwVjE3NkM5MC4yODMgMjA2LjkyOCA2NS4yMTA5IDIzMiAzNC4yODMgMjMySDIzQzE2LjM3MjYgMjMyIDExIDIzNy4zNzIgMTEgMjQ0VjI2OEMxMSAyNzQuNjI3IDE2LjM3MjQgMjgwIDIyLjk5OTYgMjgwTDM0LjI4MyAyODBDNjUuMjEwOSAyODAgOTAuMjgzIDMwNS4wNzIgOTAuMjgzIDMzNlY0NDBDOTAuMjgzIDQ3OS43NjQgMTIyLjUxOCA1MTIgMTYyLjI4MyA1MTJIMTk2LjVDMjAzLjEyNyA1MTIgMjA4LjUgNTA2LjYyNyAyMDguNSA1MDBWNDc2QzIwOC41IDQ2OS4zNzMgMjAzLjEyNyA0NjQgMTk2LjUgNDY0SDE2Mi4yODNDMTQ5LjAyOCA0NjQgMTM4LjI4MyA0NTMuMjU1IDEzOC4yODMgNDQwVjMzNkMxMzguMjgzIDMwOS4wMjIgMTI4LjAxMSAyODQuNDQzIDExMS4xNjQgMjY1Ljk2MUMxMDYuMTA5IDI2MC40M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MlYzNloiIGZpbGw9IiNGRjk5MjIiLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8xMTcxXzQ0MSI+CjxyZWN0IHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIiBmaWxsPSJ3aGl0ZSIvPgo8L2NsaXBQYXRoPgo8L2RlZnM+Cjwvc3ZnPgo="},"displayName":"Code","typeVersion":2,"nodeCategories":[{"id":5,"name":"Development"},{"id":9,"name":"Core Nodes"}]},{"id":1119,"icon":"fa:robot","name":"@n8n/n8n-nodes-langchain.agent","codex":{"data":{"alias":["LangChain","Chat","Conversational","Plan and Execute","ReAct","Tools"],"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/"}]},"categories":["AI","Langchain"],"subcategories":{"AI":["Agents","Root Nodes"]}}},"group":"[\"transform\"]","defaults":{"name":"AI Agent","color":"#404040"},"iconData":{"icon":"robot","type":"icon"},"displayName":"AI Agent","typeVersion":3,"nodeCategories":[{"id":25,"name":"AI"},{"id":26,"name":"Langchain"}]},{"id":1153,"icon":"file:openAiLight.svg","name":"@n8n/n8n-nodes-langchain.lmChatOpenAi","codex":{"data":{"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatopenai/"}]},"categories":["AI","Langchain"],"subcategories":{"AI":["Language Models","Root Nodes"],"Language Models":["Chat Models (Recommended)"]}}},"group":"[\"transform\"]","defaults":{"name":"OpenAI Chat Model"},"iconData":{"type":"file","fileBuffer":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTM2Ljg2NzEgMTYuMzcxOEMzNy43NzQ2IDEzLjY0OCAzN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Y2IDkuMzE1MzggMTMuNTc2NiA5Ljc0Nzg5IDEzLjU3OTEgMTAuMjE2N0wxMy41NzQxIDIxLjQ0MDZWMjEuNDQzMVpNMTUuNDAyOSAxNy41MDA2TDE5LjczNDIgMTQuOTk5M0wyNC4wNjU1IDE3LjQ5OTNWMjIuNTAwN0wxOS43MzQyIDI1LjAwMDdMMTUuNDAyOSAyMi41MDA3VjE3LjUwMDZaIiBmaWxsPSIjN0Q3RDg3Ii8+Cjwvc3ZnPgo="},"displayName":"OpenAI Chat Model","typeVersion":1,"nodeCategories":[{"id":25,"name":"AI"},{"id":26,"name":"Langchain"}]},{"id":1163,"icon":"fa:database","name":"@n8n/n8n-nodes-langchain.memoryBufferWindow","codex":{"data":{"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorybufferwindow/"}]},"categories":["AI","Langchain"],"subcategories":{"AI":["Memory"],"Memory":["For beginners"]}}},"group":"[\"transform\"]","defaults":{"name":"Simple Memory"},"iconData":{"icon":"database","type":"icon"},"displayName":"Simple Memory","typeVersion":1,"nodeCategories":[{"id":25,"name":"AI"},{"id":26,"name":"Langchain"}]}],"categories":[{"id":35,"name":"Document Extraction"},{"id":47,"name":"AI Chatbot"}],"image":[]}}