{
  "id": "AS7I34jGoqYKavxt",
  "meta": {
    "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\u010c`, 'string') }}",
            "ico": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('ico', `Updated I\u010cO. 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\u010c (VAT number)`, 'string') }}",
            "ico": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('ico', `8-digit I\u010cO (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\u010cO, 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\u010cO (8 digits), email address, or phone number. Prefer I\u010cO 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\u010cO (8-digit registration number) or company name. Returns company details including I\u010cO, DI\u010c, 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\u010cO). 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\u010cO 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\u00edk \u2013 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` \u2013 Search company by I\u010cO or name\n\n**Contacts:**\n- `fakturoid_get_subject` \u2013 Search contacts\n- `fakturoid_create_subject` \u2013 Create new contact\n- `fakturoid_update_subject` \u2013 Update contact details\n- `fakturoid_delete_subject` \u2013 Delete contact\n\n**Invoices:**\n- `fakturoid_get_invoice` \u2013 Search/list invoices\n- `fakturoid_create_invoice` \u2013 Create invoice\n- `fakturoid_update_invoice` \u2013 Update invoice\n- `fakturoid_delete_invoice` \u2013 Delete invoice\n- `fakturoid_invoice_payment` \u2013 Mark invoice as paid\n\n---\n\n## Entity IDs \u2013 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` \u2013 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 \u2013 NEVER use an `invoice_id` as `subject_id`\n5. If you are unsure about the correct ID, call the appropriate get tool again \u2013 NEVER reuse an ID from a different entity\n6. NEVER guess or fabricate IDs \u2013 they must always come from a tool response\n7. After deleting an invoice, the `invoice_id` is invalid and must be discarded \u2013 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: \u201eTuto akci nem\u00e1m 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 \u2013 IMPORTANT\n\n- If a contact or invoice was already fetched earlier in the conversation, use that data directly \u2013 do NOT fetch it again\n- If the user refers to a contact or invoice that was already discussed (e.g. \u201emu\", \u201ej\u00ed\", \u201et\u00e9 faktu\u0159e\"), 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 \u2013 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 \u2013 no re-fetching, no second confirmation\n\n---\n\n## Workflows\n\n### Creating an Invoice\n1. Resolve contact \u2192 use `subject_id` from conversation context if available, otherwise call `get_subject`\n2. If contact not found \u2192 `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\u010cO is provided \u2192 `ares_lookup`\n2. Show the data, ask for confirmation\n3. Create the contact\n\n### Updating an Invoice\n1. Resolve invoice \u2192 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 \u2192 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` \u2013 nothing else\n4. After successful deletion, the `invoice_id` is no longer valid \u2013 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 \u2013 Important\n\n- Once the user confirms an action (e.g. \u201eAno\"), 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: \u201e5 000 K\u010d\"\n- Dates: \u201e9. \u00fanora 2024\"\n- Invoice numbers: \u201eFaktura 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
      ],
      "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": {
          "name": "<your credential>"
        }
      },
      "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 \u2014 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 \u2014 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,
  "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
          }
        ]
      ]
    }
  }
}