{"workflow":{"id":13987,"name":"Manage invoices and contacts via chat with the Fakturoid AI agent","views":11,"recentViews":0,"totalViews":11,"createdAt":"2026-03-10T22:50:51.635Z","description":"## Overview\n\nFakturoid AI Agent is an AI-powered invoicing assistant for Czech freelancers and small businesses. It connects to Fakturoid — the most popular Czech invoicing platform — and lets you manage invoices and contacts through natural conversation. No switching tabs, no filling forms. Just chat in Czech and the agent handles the rest.\n\nThe agent understands context across the conversation. Tell it to create an invoice for a client you just looked up and it won't ask for their ID again — it already has it.\n\n---\n\n## Key Features\n\n- **Full invoice lifecycle**: Create, search, update, delete, and mark invoices as paid\n- **Contact management**: Search, create, update and delete Fakturoid contacts\n- **ARES integration**: Auto-fill company details from the Czech business registry by IČO or name\n- **Conversation context**: Agent remembers entities across the conversation — no repeated lookups\n- **Confirmation flow**: Always confirms before creating, deleting or marking as paid\n- **Lean interaction**: Infers item names, quantities and prices from natural input — no unnecessary questions\n- **Modular architecture**: 10 independent sub-workflows as tools, easy to extend or swap\n\n---\n\n## Use Cases\n\n- Create invoices by describing what you did: *\"Faktura pro Alzu za 3h konzultace po 2500 Kč\"*\n- Look up unpaid invoices for a specific client\n- Update due dates or notes on existing invoices\n- Register new clients directly from ARES with one confirmation\n- Mark invoices as paid after receiving payment\n- Delete draft or duplicate invoices\n\n---\n\n## Perfect For\n\n- Czech freelancers managing invoicing without an accountant\n- Small businesses looking to reduce time spent in Fakturoid UI\n- Developers building invoicing bots for Czech clients\n- Anyone already using Fakturoid who wants a conversational interface\n\n---\n\n## What You'll Need\n\n### Tools - subflows\n- Please download them directly from \n[https://drive.google.com/drive/folders/1Y9YmZBk-hwHfo4IPJG9Ng8CUo_38pTX4?usp=drive_link](https://drive.google.com/drive/folders/1Y9YmZBk-hwHfo4IPJG9Ng8CUo_38pTX4?usp=drive_link)\n\n\n### Required Credentials\n- **Fakturoid API token** — found in Fakturoid Settings → API\n- **Fakturoid account slug** — the subdomain part of your Fakturoid URL (e.g. `yourname` from `app.fakturoid.cz/yourname`)\n- **LLM API key** — OpenAI, Anthropic, or any provider supported by n8n AI Agent node\n\n### Requirements\n- Active Fakturoid account (any plan)\n- n8n instance with AI Agent node support\n\n---\n\n## Technical Details\n\n### Architecture\n- 1 main agent workflow + 10 sub-workflows connected as tools\n- Each sub-workflow handles one Fakturoid API operation\n- Sub-workflows normalize API responses — only relevant fields are passed back to the agent\n- Response processing uses a consistent JS pattern across all tools\n\n### Tools\n| Tool | Operation |\n|---|---|\n| `ares_lookup` | Search Czech business registry |\n| `fakturoid_get_subject` | Search contacts |\n| `fakturoid_create_subject` | Create contact |\n| `fakturoid_update_subject` | Update contact |\n| `fakturoid_delete_subject` | Delete contact |\n| `fakturoid_get_invoice` | Search / list invoices |\n| `fakturoid_create_invoice` | Create invoice |\n| `fakturoid_update_invoice` | Update invoice |\n| `fakturoid_delete_invoice` | Delete invoice |\n| `fakturoid_invoice_payment` | Mark invoice as paid |\n\n### Agent Behavior\n- System prompt written in English, agent communicates in Czech\n- Uses `&lt;thinking&gt;` blocks before write operations to verify correct entity IDs\n- Explicit rules to distinguish `subject_id`, `invoice_id`, and IČO — prevents cross-contamination\n- Confirmation required before: invoice creation, deletion, marking as paid\n\n### API\n- Fakturoid API v3\n- ARES API (Czech business registry, no key required)\n\n---\n\n## Template Author\n\nQuestions or need help with setup?\n📧 Email: [xciklv@gmail.com](mailto:xciklv@gmail.com)\n💼 LinkedIn:\n[https://www.linkedin.com/in/vaclavcikl/](https://www.linkedin.com/in/vaclavcikl/)","workflow":{"id":"AS7I34jGoqYKavxt","meta":{"instanceId":"b1699e1d8ef82aaaaf2eed0ed67f215d7574a625e2d012a1bcd013054b0defdf","templateCredsSetupCompleted":true},"name":"AI Invoice Assistant_TEMPLATE","tags":[],"nodes":[{"id":"343031fe-b861-4e20-b2c5-acc8757ef37a","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-1344,-128],"parameters":{"contextWindowLength":10},"typeVersion":1.3},{"id":"b8729a40-f11a-4ca0-83af-73e67379af28","name":"INVOICE_PAYMENT","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-512,128],"parameters":{"workflowId":{"__rl":true,"mode":"list","value":"nM6KDKEpkqatSCQc","cachedResultUrl":"/workflow/nM6KDKEpkqatSCQc","cachedResultName":"Fakturoid_invoice_paymentTEMPLATE"},"description":"Mark invoice as paid or record payment. If paid_on date is provided, marks invoice as fully paid on that date. Requires invoice_id from fakturoid_get_invoice.","workflowInputs":{"value":{"paid_on":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('paid_on', `Payment date in YYYY-MM-DD format (e.g., '2024-02-09'). Defaults to today if not provided.`, 'string') }}","invoice_id":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('invoice_id', `ID of invoice to delete (required). Get this from fakturoid_get_invoice.`, 'number') }}","payment_method":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('payment_method', `Payment method (optional): 'bank_transfer', 'cash', 'card', 'paypal'`, 'string') }}"},"schema":[{"id":"invoice_id","type":"number","display":true,"removed":false,"required":false,"displayName":"invoice_id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"paid_on","type":"string","display":true,"removed":false,"required":false,"displayName":"paid_on","defaultMatch":false,"canBeUsedToMatch":true},{"id":"payment_method","type":"string","display":true,"removed":false,"required":false,"displayName":"payment_method","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"1e9ca13d-3650-46aa-8d3c-2395f3ccb290","name":"UPDATE_SUBJECT","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-1104,48],"parameters":{"workflowId":{"__rl":true,"mode":"list","value":"jXIz2pM85LjrUfyp","cachedResultUrl":"/workflow/jXIz2pM85LjrUfyp","cachedResultName":"Fakturoid_update_subject_TEMPLATE"},"description":"Update existing contact/client in Fakturoid. Only provided fields will be updated, others remain unchanged. Requires subject_id from fakturoid_get_subject.","workflowInputs":{"value":{"dic":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('dic', `Updated DIČ`, 'string') }}","ico":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('ico', `Updated IČO. This is not subject_id`, 'string') }}","zip":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('zip', `Updated ZIP code`, 'string') }}","city":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('city', `Updated city`, 'string') }}","name":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('name', `Updated company/person name`, 'string') }}","email":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('email', `Updated email`, 'string') }}","phone":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('phone', `Updated phone`, 'string') }}","street":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('street', `Updated street address`, 'string') }}","subject_id":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('subject_id', `ID of subject to update (required). Get this from fakturoid_get_subject. THIS IS NOT ico. `, 'string') }}"},"schema":[{"id":"subject_id","type":"string","display":true,"removed":false,"required":false,"displayName":"subject_id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"name","type":"string","display":true,"removed":false,"required":false,"displayName":"name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ico","type":"string","display":true,"removed":false,"required":false,"displayName":"ico","defaultMatch":false,"canBeUsedToMatch":true},{"id":"dic","type":"string","display":true,"removed":false,"required":false,"displayName":"dic","defaultMatch":false,"canBeUsedToMatch":true},{"id":"street","type":"string","display":true,"removed":false,"required":false,"displayName":"street","defaultMatch":false,"canBeUsedToMatch":true},{"id":"city","type":"string","display":true,"removed":false,"required":false,"displayName":"city","defaultMatch":false,"canBeUsedToMatch":true},{"id":"zip","type":"string","display":true,"removed":false,"required":false,"displayName":"zip","defaultMatch":false,"canBeUsedToMatch":true},{"id":"email","type":"string","display":true,"removed":false,"required":false,"displayName":"email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"phone","type":"string","display":true,"removed":false,"required":false,"displayName":"phone","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"06ec1af9-32eb-4f1d-9486-7aafd75adfe9","name":"CREATE_SUBJECT","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-1216,144],"parameters":{"workflowId":{"__rl":true,"mode":"list","value":"XW7U0YtRiZeMpCRi","cachedResultUrl":"/workflow/XW7U0YtRiZeMpCRi","cachedResultName":"Fakturoid_create_subject_TEMPLATE"},"description":"Create new subject/ contact /client in Fakturoid. Use data from ares_lookup if available to auto-fill fields. Returns subject_id needed for creating invoices.","workflowInputs":{"value":{"dic":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('dic', `DIČ (VAT number)`, 'string') }}","ico":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('ico', `8-digit IČO (registration number)`, 'string') }}","zip":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('zip', `ZIP/postal code`, 'string') }}","city":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('city', `City name`, 'string') }}","name":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('name', `Company or person name (required)`, 'string') }}","email":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('email', `Email address`, 'string') }}","phone":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('phone', `Phone number`, 'string') }}","street":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('street', `Street address`, 'string') }}"},"schema":[{"id":"name","type":"string","display":true,"removed":false,"required":false,"displayName":"name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ico","type":"string","display":true,"removed":false,"required":false,"displayName":"ico","defaultMatch":false,"canBeUsedToMatch":true},{"id":"email","type":"string","display":true,"removed":false,"required":false,"displayName":"email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"phone","type":"string","display":true,"removed":false,"required":false,"displayName":"phone","defaultMatch":false,"canBeUsedToMatch":true},{"id":"street","type":"string","display":true,"removed":false,"required":false,"displayName":"street","defaultMatch":false,"canBeUsedToMatch":true},{"id":"city","type":"string","display":true,"removed":false,"required":false,"displayName":"city","defaultMatch":false,"canBeUsedToMatch":true},{"id":"zip","type":"string","display":true,"removed":false,"required":false,"displayName":"zip","defaultMatch":false,"canBeUsedToMatch":true},{"id":"dic","type":"string","display":true,"removed":false,"required":false,"displayName":"dic","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"1f9f5a09-21bf-4498-9dbf-094848309739","name":"GET_SUBJECT","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-1312,48],"parameters":{"workflowId":{"__rl":true,"mode":"list","value":"x2F0ZxrGsSSVMsHp","cachedResultUrl":"/workflow/x2F0ZxrGsSSVMsHp","cachedResultName":"Fakturoid_get_subject_TEMPLATE"},"description":"Search for existing contacts/clients in Fakturoid by name, IČO, email, or phone. Returns contact details including subject_id needed for creating invoices. ALWAYS use this before creating new contact to avoid duplicates.","workflowInputs":{"value":{"query":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('query', `Search term - can be company name, IČO (8 digits), email address, or phone number. Prefer IČO if available for most accurate match.`, 'string') }}"},"schema":[{"id":"query","type":"string","display":true,"removed":false,"required":false,"displayName":"query","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["query"],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"06f507a2-33f0-47c8-a077-a6e3f83a88f5","name":"ARES LOOKUP","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-1424,112],"parameters":{"workflowId":{"__rl":true,"mode":"list","value":"Y8AeWLK8FzC3kZYmAVhVf","cachedResultUrl":"/workflow/Y8AeWLK8FzC3kZYmAVhVf","cachedResultName":"ARESCaller"},"description":"Search Czech business registry (ARES) by company IČO (8-digit registration number) or company name. Returns company details including IČO, DIČ, full legal name, and address. Use this to auto-fill company data when creating contacts.","workflowInputs":{"value":{"ICO":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('ICO', `8-digit company registration number (IČO). Prefer this over name for most accurate results.`, 'number') }}","CompanyName":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('CompanyName', `Company name to search for. Use if IČO is not available.`, 'string') }}"},"schema":[{"id":"ICO","type":"number","display":true,"removed":false,"required":false,"displayName":"ICO","defaultMatch":false,"canBeUsedToMatch":true},{"id":"CompanyName","type":"string","display":true,"removed":false,"required":false,"displayName":"CompanyName","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"692a8457-2540-4382-a196-614673593cac","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1456,16],"parameters":{"color":6,"width":576,"height":272,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## CONTACTS"},"typeVersion":1},{"id":"c692e7e2-9d78-43f5-88eb-b04448c7b707","name":"CREATE_INVOICE","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-816,32],"parameters":{"workflowId":{"__rl":true,"mode":"list","value":"Otewvb4hm364Skd2","cachedResultUrl":"/workflow/Otewvb4hm364Skd2","cachedResultName":"Fakturoid_create_invoice_TEMPLATE"},"description":"Create new invoice in Fakturoid for existing subject. ALWAYS show user a summary with item breakdown and total amount, then ask for confirmation before creating. Returns invoice_id, number, and Public PDF URL.","workflowInputs":{"value":{"note":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('note', `Optional note`, 'string') }}","lines":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('lines', `Lines must use exactly these field names: name (string), quantity (number), unit_price (number). Do NOT use amount, price, or unit.`, 'json') }}","subject_id":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('subject_id', `ID of existing subject/contact (required). Get this from fakturoid_get_subject`, 'number') }}"},"schema":[{"id":"subject_id","type":"number","display":true,"removed":false,"required":false,"displayName":"subject_id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"lines","type":"array","display":true,"removed":false,"required":false,"displayName":"lines","defaultMatch":false,"canBeUsedToMatch":true},{"id":"note","type":"string","display":true,"removed":false,"required":false,"displayName":"note","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"820b8624-3880-43b7-8ddb-d27980438db2","name":"GET_INVOICE","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-720,128],"parameters":{"workflowId":{"__rl":true,"mode":"list","value":"oNKwEN15gPaAWSsu","cachedResultUrl":"/workflow/oNKwEN15gPaAWSsu","cachedResultName":"Fakturoid_get_invoice_TEMPLATE"},"description":"Search for invoices or get invoice detail. Can search by invoice number, subject name, or list recent invoices. Returns invoice_id, number, amounts, status, and PDF links.","workflowInputs":{"value":{"limit":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('limit', `Max results (default: 10)`, 'number') }}","query":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('query', `Search term - invoice number, client name, etc.`, 'string') }}","Invoice_id":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Invoice_id', `Specific invoice ID to fetch detail`, 'string') }}"},"schema":[{"id":"Invoice_id","type":"string","display":true,"removed":false,"required":false,"displayName":"Invoice_id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"query","type":"string","display":true,"removed":false,"required":false,"displayName":"query","defaultMatch":false,"canBeUsedToMatch":true},{"id":"limit","type":"number","display":true,"removed":false,"required":false,"displayName":"limit","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["parameters"],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"f9242984-dd15-410a-82d2-8ae45880aa5b","name":"DELETE_INVOICE","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-624,32],"parameters":{"workflowId":{"__rl":true,"mode":"list","value":"LsmsxYwHnMcbKjet","cachedResultUrl":"/workflow/LsmsxYwHnMcbKjet","cachedResultName":"Fakturoid_delete_invoice_TEMPLATE"},"description":"Delete invoice from Fakturoid. Can only delete unpaid invoices. ALWAYS ask user for confirmation before deleting. Requires invoice_id from fakturoid_get_invoice.  USE IT ONLY FOR DELETING INVOICES.","workflowInputs":{"value":{"invoice_id":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('invoice_id', `ID of invoice to delete (required). Get this from fakturoid_get_invoice.`, 'number') }}"},"schema":[{"id":"invoice_id","type":"number","display":true,"removed":false,"required":false,"displayName":"invoice_id","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["invoice_id"],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"0d1de8a5-a7e7-4ee5-a04f-579be8a55b2f","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-864,16],"parameters":{"color":5,"width":592,"height":272,"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## INVOICES"},"typeVersion":1},{"id":"a960e53a-bca3-4eab-9734-2fbb191877fe","name":"UPDATE_INVOICE","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-416,32],"parameters":{"workflowId":{"__rl":true,"mode":"list","value":"TpOq2gGQ25lbInlm","cachedResultUrl":"/workflow/TpOq2gGQ25lbInlm","cachedResultName":"Fakturoid_update_invoice_TEMPLATE"},"description":"Update existing invoice. Can change due date, add notes, or update invoice number. Only provided fields will be changed. Requires invoice_id from fakturoid_get_invoice.","workflowInputs":{"value":{"note":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('note', `Public note visible on invoice`, 'string') }}","due_on":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('due_on', `New due date in YYYY-MM-DD format (e.g., '2024-03-31')`, 'string') }}","number":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('number', `Invoice number`, 'string') }}","invoice_id":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('invoice_id', `ID of invoice to update (required). Get this from fakturoid_get_invoice.`, 'number') }}","private_note":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('private_note', `Private internal note (not visible to client)`, 'string') }}"},"schema":[{"id":"invoice_id","type":"number","display":true,"removed":false,"required":false,"displayName":"invoice_id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"due_on","type":"string","display":true,"removed":false,"required":false,"displayName":"due_on","defaultMatch":false,"canBeUsedToMatch":true},{"id":"note","type":"string","display":true,"removed":false,"required":false,"displayName":"note","defaultMatch":false,"canBeUsedToMatch":true},{"id":"private_note","type":"string","display":true,"removed":false,"required":false,"displayName":"private_note","defaultMatch":false,"canBeUsedToMatch":true},{"id":"number","type":"string","display":true,"removed":false,"required":false,"displayName":"number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"34049bb6-a8f5-47f0-aa14-b74119dc33f6","name":"DELETE_SUBJECT","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-992,144],"parameters":{"workflowId":{"__rl":true,"mode":"list","value":"CcYWBnucFh1OoivN","cachedResultUrl":"/workflow/CcYWBnucFh1OoivN","cachedResultName":"Fakturoid_delete_subject_TEMPLATE"},"description":"Delete subject/ contact /client in Fakturoid by subject_id.","workflowInputs":{"value":{"subject_id":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('subject_id', `ID of subject to update (required). Get this from fakturoid_get_subject. `, 'number') }}"},"schema":[{"id":"subject_id","type":"number","display":true,"removed":false,"required":false,"displayName":"subject_id","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["subject_id"],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"c963c5f2-f9fe-4949-b5cd-3ed6d1b6d584","name":"AI Agent1","type":"@n8n/n8n-nodes-langchain.agent","position":[-1040,-288],"parameters":{"options":{"systemMessage":"# Invoice Botík – System Prompt\n\nYou are an invoice and contact management assistant for Czech freelancers and businesses. You communicate in Czech.\n\n---\n\n## Available Tools\n\n**ARES Registry:**\n- `ares_lookup` – Search company by IČO or name\n\n**Contacts:**\n- `fakturoid_get_subject` – Search contacts\n- `fakturoid_create_subject` – Create new contact\n- `fakturoid_update_subject` – Update contact details\n- `fakturoid_delete_subject` – Delete contact\n\n**Invoices:**\n- `fakturoid_get_invoice` – Search/list invoices\n- `fakturoid_create_invoice` – Create invoice\n- `fakturoid_update_invoice` – Update invoice\n- `fakturoid_delete_invoice` – Delete invoice\n- `fakturoid_invoice_payment` – Mark invoice as paid\n\n---\n\n## Entity IDs – CRITICAL RULES\n\nThe system works with two distinct entity types. Their IDs are DIFFERENT values and must NEVER be confused:\n\n| Entity | ID field | Obtained from | Used for |\n|---|---|---|---|\n| Contact (subject) | `subject_id` | `fakturoid_get_subject` | `create_invoice`, `update_subject`, `delete_subject` |\n| Invoice | `invoice_id` | `fakturoid_get_invoice` | `update_invoice`, `delete_invoice`, `invoice_payment` |\n\n**Rules:**\n1. After every tool call, explicitly remember the returned ID and its type (`subject_id` or `invoice_id`)\n2. `subject_id` from `get_subject` is ALWAYS a different value than `invoice_id` from `get_invoice` – never mix them up\n3. Before calling `update_invoice` or `delete_invoice`, always verify you are using `invoice_id` (not `subject_id`)\n4. Before calling `create_invoice`, always verify that `subject_id` comes from a `get_subject` result – NEVER use an `invoice_id` as `subject_id`\n5. If you are unsure about the correct ID, call the appropriate get tool again – NEVER reuse an ID from a different entity\n6. NEVER guess or fabricate IDs – they must always come from a tool response\n7. After deleting an invoice, the `invoice_id` is invalid and must be discarded – if the user then asks to create a new invoice, use the `subject_id` from `get_subject` context, NOT the deleted `invoice_id`\n\nBefore calling any write tool (`create_invoice`, `update_invoice`, `delete_invoice`, `invoice_payment`), reason through the following in a `<thinking>` block (never shown to user):\n- What is the subject_id I have, and where did it come from?\n- What is the invoice_id I have, and where did it come from?\n- Which ID does this action require, and am I using the correct one?\n\n---\n\n## General Rules\n\n1. Use tools only for their intended purpose (subject tools for contacts, invoice tools for invoices)\n2. If the user requests an action for which you have no tool, respond: „Tuto akci nemám k dispozici\"\n3. Always ask for confirmation before: creating an invoice, deleting, marking as paid\n4. Show a summary before destructive actions (delete, mark as paid)\n\n---\n\n## Conversation Context – IMPORTANT\n\n- If a contact or invoice was already fetched earlier in the conversation, use that data directly – do NOT fetch it again\n- If the user refers to a contact or invoice that was already discussed (e.g. „mu\", „jí\", „té faktuře\"), resolve the reference from conversation history\n- Only call `get_subject` if you genuinely do not have the `subject_id` yet\n\n---\n\n## Invoice Creation – Keep It Lean\n\nWhen creating an invoice, collect only what is necessary:\n- **Contact**: resolve from conversation context if already known, otherwise call `get_subject`\n- **Line items**: infer name, quantity and price from what the user said. Ask only for what is genuinely missing\n- **Notes**: do NOT ask about notes unless the user brings them up\n- Once you have contact + line items, show a single confirmation summary and wait for approval\n- After approval, create the invoice immediately – no re-fetching, no second confirmation\n\n---\n\n## Workflows\n\n### Creating an Invoice\n1. Resolve contact → use `subject_id` from conversation context if available, otherwise call `get_subject`\n2. If contact not found → `ares_lookup`, offer to create the contact\n3. Infer line items from user input. Ask only for genuinely missing information (do not ask for notes unprompted)\n4. Show a single summary with items and total, ask for confirmation\n5. On confirmation, call `create_invoice` immediately using the `subject_id` already in context\n\n### Creating a Contact\n1. If IČO is provided → `ares_lookup`\n2. Show the data, ask for confirmation\n3. Create the contact\n\n### Updating an Invoice\n1. Resolve invoice → use `invoice_id` from conversation context if available, otherwise call `get_invoice`\n2. Show current value and proposed change, ask for confirmation\n3. On confirmation, call `update_invoice` immediately using the `invoice_id` already in context\n\n### Deleting an Invoice\n1. Resolve invoice → use `invoice_id` from conversation context if available, otherwise call `get_invoice`\n2. Show invoice summary, ask for confirmation\n3. On confirmation, call `delete_invoice` using the `invoice_id` – nothing else\n4. After successful deletion, the `invoice_id` is no longer valid – do NOT use it for any further action\n5. Do NOT call `create_invoice` after deletion unless the user explicitly asks to create a new invoice\n\n---\n\n## Confirmation Flow – Important\n\n- Once the user confirms an action (e.g. „Ano\"), execute it IMMEDIATELY\n- Do NOT ask the same confirmation question again\n- Do NOT re-fetch entities you already have from earlier tool calls in the same conversation\n- Repeating confirmations or lookups is an error\n\n---\n\n## Formatting\n\n- Currency: „5 000 Kč\"\n- Dates: „9. února 2024\"\n- Invoice numbers: „Faktura 2026-0003\""}},"typeVersion":3.1},{"id":"f59b00a5-bb66-41b8-8608-737bf60c726c","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[-1440,-320],"webhookId":"38cf5fec-cff0-4a75-8df8-1a572659421d","parameters":{"options":{}},"typeVersion":1.4},{"id":"5975bc1a-38e6-45da-b888-73c74a36b345","name":"GPT-5-mini","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-1456,-112],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"SejrVHsogrtvT4yC","name":"TEMPLATE"}},"typeVersion":1},{"id":"a808fbc9-1f59-4afe-bd63-580113a6d74f","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-1888,-336],"parameters":{"color":"#C34B4B","width":400,"height":624,"content":"## How it works\n\nAI agent connected to Fakturoid API and ARES registry. Handles invoicing and contact management through natural Czech conversation — no forms, no clicking.\n\n**What the agent can do:**\n- Search, create, update and delete contacts (with ARES lookup for auto-fill)\n- Search, create, update and delete invoices\n- Mark invoices as paid\n\n**Architecture:**\nThe agent workflow connects to 10 sub-workflows as tools — each handles one Fakturoid operation. Sub-workflows normalize API responses and pass only relevant fields back to the agent.\n\n## Setup steps\n\n1. Add your **Fakturoid API token** and **account slug** to the Fakturoid HTTP Request nodes\n2. Connect your **LLM credentials** (OpenAI, Anthropic, or any compatible provider) to the AI Agent node\n3. Activate all sub-workflows before activating the main agent workflow\n4. Open the chat and start invoicing"},"typeVersion":1}],"active":true,"pinData":{},"settings":{"availableInMCP":false,"executionOrder":"v1"},"versionId":"171164bf-0a64-44e8-8e6e-761dd354d4be","connections":{"GPT-5-mini":{"ai_languageModel":[[{"node":"AI Agent1","type":"ai_languageModel","index":0}]]},"ARES LOOKUP":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"GET_INVOICE":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"GET_SUBJECT":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent1","type":"ai_memory","index":0}]]},"CREATE_INVOICE":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"CREATE_SUBJECT":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"DELETE_INVOICE":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"DELETE_SUBJECT":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"UPDATE_INVOICE":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"UPDATE_SUBJECT":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"INVOICE_PAYMENT":{"ai_tool":[[{"node":"AI Agent1","type":"ai_tool","index":0}]]},"When chat message received":{"main":[[{"node":"AI Agent1","type":"main","index":0}]]}}},"lastUpdatedBy":1,"workflowInfo":{"nodeCount":17,"nodeTypes":{"n8n-nodes-base.stickyNote":{"count":3},"@n8n/n8n-nodes-langchain.agent":{"count":1},"@n8n/n8n-nodes-langchain.chatTrigger":{"count":1},"@n8n/n8n-nodes-langchain.lmChatOpenAi":{"count":1},"@n8n/n8n-nodes-langchain.toolWorkflow":{"count":10},"@n8n/n8n-nodes-langchain.memoryBufferWindow":{"count":1}}},"status":"published","readyToDemo":null,"user":{"name":"Václav Čikl","username":"venca","bio":"","verified":true,"links":["https://www.linkedin.com/in/vaclavcikl/"],"avatar":"https://gravatar.com/avatar/fa2e565f6146036370be46861566a0c4bad172dbac8873fcfeb6567755f41835?r=pg&d=retro&size=200"},"nodes":[{"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":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,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTM2Ljg2NzEgMT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DAzTDE0LjIzNDEgOS4wODQxM0MxMy44MjY2IDkuMzE1MzggMTMuNTc2NiA5Ljc0Nzg5IDEzLjU3OTEgMTAuMjE2N0wxMy41NzQxIDIxLjQ0MDZWMjEuNDQzMVpNMTUuNDAyOSAxNy41MDA2TDE5LjczNDIgMTQuOTk5M0wyNC4wNjU1IDE3LjQ5OTNWMjIuNTAwN0wxOS43MzQyIDI1LjAwMDdMMTUuNDAyOSAyMi41MDA3VjE3LjUwMDZaIiBmaWxsPSIjN0Q3RDg3Ii8+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"}]},{"id":1205,"icon":"fa:network-wired","name":"@n8n/n8n-nodes-langchain.toolWorkflow","codex":{"data":{"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolworkflow/"}]},"categories":["AI","Langchain"],"subcategories":{"AI":["Tools"],"Tools":["Recommended Tools"]}}},"group":"[\"transform\"]","defaults":{"name":"Call n8n Workflow Tool"},"iconData":{"icon":"network-wired","type":"icon"},"displayName":"Call n8n Workflow Tool","typeVersion":2,"nodeCategories":[{"id":25,"name":"AI"},{"id":26,"name":"Langchain"}]},{"id":1247,"icon":"fa:comments","name":"@n8n/n8n-nodes-langchain.chatTrigger","codex":{"data":{"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.chattrigger/"}]},"categories":["Core Nodes","Langchain"]}},"group":"[\"trigger\"]","defaults":{"name":"When chat message received"},"iconData":{"icon":"comments","type":"icon"},"displayName":"Chat Trigger","typeVersion":1,"nodeCategories":[{"id":9,"name":"Core Nodes"},{"id":26,"name":"Langchain"}]}],"categories":[{"id":34,"name":"Invoice Processing"},{"id":47,"name":"AI Chatbot"}],"image":[]}}