Skip to content

⚙️ Setting up n8n

1. Import the Workflow

  1. Open your n8n dashboard
  2. Click Import Workflow and select ai-finence.json
  3. Save and activate
json
{
  "name": "Ai Finence",
  "nodes": [
    {
      "parameters": {
        "options": {
          "systemMessage": "=You are a personal finance assistant. You can record, retrieve, and summarize expenses in a Google Sheet. The sheet contains the following columns:\n\n- Date: The date of the expense (format: YYYY-MM-DD).\n- Details: A short description of what the expense was.\n- Category: One of the following — Transportation, Breakfast, Lunch, Dinner, Smoke, Donation, Mobile Recharge, Others.\n- Amount: The numerical value of the expense in currency.\n\nONLY use these exact columns. Do not invent new columns or categories.\n\n### When ADDING a new expense:\n- Confirm with me before entering.\n- Re-confirm or ask questions if the category is unclear.\n- Do not assume or autofill missing fields.\n\n### When RETRIEVING or SUMMARIZING:\n- Always use tool outputs (from \"Get All Expense\" or \"Get Expense By Category\").\n- Never generate made-up data or summaries. Only respond based on the actual sheet content.\n- If asked to calculate a total, average, or perform arithmetic, use the Calculator tool and sum only the 'Amount' values retrieved from the sheet.\n- If no entries are found or inputs are missing, ask for clarification.\n\nIf you are unsure — ask. Do not assume.\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.1,
      "position": [
        128,
        -96
      ],
      "id": "87f82d35-7976-4b32-9472-a15b85366172",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "public": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -144,
        -96
      ],
      "id": "c66487e7-3409-499a-a9bd-644cd6abaae4",
      "name": "Chat",
      "webhookId": "7efae6b5-cee0-4b3e-b1f0-907f56a175f5"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        160,
        128
      ],
      "id": "91450fd1-e266-49d2-9f00-d93fd7b39ddb",
      "name": "Calculator"
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Retrieve all expense rows from the sheet where the 'Category' column matches the input. Use only the following columns in the response: Date, Details, Category, Amount. Do not add any information beyond what is found in the sheet.",
        "documentId": {
          "__rl": true,
          "value": "1ljqJg_sSDgVn1xxkuR9nALGuBZRRk06xhShFfSz94Fg",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "expense",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ljqJg_sSDgVn1xxkuR9nALGuBZRRk06xhShFfSz94Fg/edit#gid=0"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Category",
              "lookupValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('values0_Value', ``, 'string') }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.6,
      "position": [
        288,
        128
      ],
      "id": "9c748fbd-faef-4566-8a97-e6879d7efa65",
      "name": "Get Expense By Category",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "GtncdUWvkzlTNFs8",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Append a new expense entry to the sheet using the columns: Date, Details, Category, Amount. Use only the allowed categories: Transportation, Breakfast, Lunch, Dinner, Smoke, Donation, Mobile Recharge, Others. Confirm details before adding. Do not assume values or categories.",
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1ljqJg_sSDgVn1xxkuR9nALGuBZRRk06xhShFfSz94Fg",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "expense",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ljqJg_sSDgVn1xxkuR9nALGuBZRRk06xhShFfSz94Fg/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date', ``, 'string') }}",
            "Details": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Details', ``, 'string') }}",
            "Category": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Category', ``, 'string') }}",
            "Amount": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Amount', ``, 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Details",
              "displayName": "Details",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Category",
              "displayName": "Category",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Amount",
              "displayName": "Amount",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.6,
      "position": [
        416,
        128
      ],
      "id": "70d29e82-fa02-497f-a482-9d5cdba7a97b",
      "name": "Add Expense",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "GtncdUWvkzlTNFs8",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Retrieve all entries from the expense sheet. Only return the actual rows from the sheet with columns: Date, Details, Category, Amount. Do not guess or summarize unless explicitly asked.",
        "documentId": {
          "__rl": true,
          "value": "1ljqJg_sSDgVn1xxkuR9nALGuBZRRk06xhShFfSz94Fg",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "expense",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ljqJg_sSDgVn1xxkuR9nALGuBZRRk06xhShFfSz94Fg/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.6,
      "position": [
        544,
        128
      ],
      "id": "bba100f1-9449-46d2-a2b5-a9d943ea4dcc",
      "name": "Get All Expense",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "GtncdUWvkzlTNFs8",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        32,
        128
      ],
      "id": "74b2e26f-50bb-402e-90d8-443ec136b610",
      "name": "Chat Memory"
    },
    {
      "parameters": {
        "model": "open-mistral-nemo",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "typeVersion": 1,
      "position": [
        -96,
        128
      ],
      "id": "f977d997-b93b-4596-9988-9755ff91d7dd",
      "name": "Mistral Nemo",
      "credentials": {
        "mistralCloudApi": {
          "id": "M779LP2czdhJd5IH",
          "name": "Mistral Cloud account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Chat": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Expense By Category": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Add Expense": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get All Expense": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Nemo": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "71587af3-6bd5-4d69-a3b9-c2e2e80b7f5e",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "75cb9b7927b10691e2d3942a9905c301af0c1dd5f1b40790e198952a5e13d779"
  },
  "id": "F0aT4dyzy3X4Wg8w",
  "tags": []
}

2. API Keys Required

You will need to configure the following credentials:

Create and name them:

  • Google Sheets account
  • Mistral Cloud account

🧠 Optional:

Enable a memory buffer node (Chat Memory) for natural context.