From baa7c70df6c8edb6db8462638118725cf4490477 Mon Sep 17 00:00:00 2001 From: nusquama Date: Sun, 15 Mar 2026 12:00:47 +0800 Subject: [PATCH] creation --- ...voices_and_contacts_via_chat_with_the_fakturoid_ai_agent.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 workflows/Manage invoices and contacts via chat with the Fakturoid AI agent-13987/manage_invoices_and_contacts_via_chat_with_the_fakturoid_ai_agent.json diff --git a/workflows/Manage invoices and contacts via chat with the Fakturoid AI agent-13987/manage_invoices_and_contacts_via_chat_with_the_fakturoid_ai_agent.json b/workflows/Manage invoices and contacts via chat with the Fakturoid AI agent-13987/manage_invoices_and_contacts_via_chat_with_the_fakturoid_ai_agent.json new file mode 100644 index 000000000..7838cacc6 --- /dev/null +++ b/workflows/Manage invoices and contacts via chat with the Fakturoid AI agent-13987/manage_invoices_and_contacts_via_chat_with_the_fakturoid_ai_agent.json @@ -0,0 +1 @@ +{"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 `` 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}]]}}} \ No newline at end of file