{
  "id": "nHEQdReBUI5V4n62",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Scheduled Telegram Digests from your Personal Finance Notion System",
  "tags": [],
  "nodes": [
    {
      "id": "a05bb08f-2323-421d-91ee-00758890fc24",
      "name": "Daily Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -336,
        -480
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c4d30ff0-3400-4caa-9a30-ff8cd98f6a06",
      "name": "Weekly Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -336,
        -304
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtHour": 1
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "11911167-241a-4170-a4d4-4adc31de46d3",
      "name": "Set Fields2",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        -96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d08d5cbf-95fc-404f-b0e3-88429acb1ba2",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "5b33dc71-88b8-4769-b92b-efb66817af79",
              "name": "next-date",
              "type": "string",
              "value": "={{ $json.property_next_date.start }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8ee6612c-49bf-4a2a-8a10-994f59de6d71",
      "name": "Items to Message2",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        -96
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Total Financial Obligations - \" + $input.all().length + \"\\n\\n\"\nlet index = 1\nfor (const item of $input.all()) {\n  message+=index+\") \"\n  message+=item.json.name + \": \"\n  message+=item.json['next-date'] +\"\\n\"\n}\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "408296f9-b333-4005-9e93-758882d06f4a",
      "name": "Send Message4",
      "type": "n8n-nodes-base.telegram",
      "position": [
        752,
        -480
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{chat_id}}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "92419151-24fd-4d63-916f-e1889ebd6783",
      "name": "Get Financial Obligations",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        -96
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Next Date|date",
              "date": "={{ $now }}",
              "condition": "on_or_before"
            },
            {
              "key": "Type|select",
              "condition": "equals",
              "selectValue": "Financial"
            },
            {
              "key": "Repeat Type|select",
              "condition": "does_not_equal",
              "selectValue": "off"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "matchType": "allFilters",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "1731d3fa-a0a0-8092-94a8-f8b5a5fa19df",
          "cachedResultUrl": "https://www.notion.so/1731d3faa0a0809294a8f8b5a5fa19df",
          "cachedResultName": "Scheduler"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1a5cf9ed-c4e3-48eb-920e-40d75115442b",
      "name": "Summarize",
      "type": "n8n-nodes-base.summarize",
      "position": [
        208,
        -288
      ],
      "parameters": {
        "options": {},
        "fieldsToSummarize": {
          "values": [
            {
              "field": "property_cost",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "043ab160-7bd1-4104-aeb6-ec53b5ee7eee",
      "name": "Items to Message",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        -288
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Total Expenses Today - Rs \" + $input.first().json.sum_property_cost\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "55bf116d-62bf-4e9b-adfe-d65a91682693",
      "name": "Get Debit Transactions",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        -288
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Created time|created_time",
              "condition": "on_or_after",
              "createdTimeValue": "={{ $now.startOf('day') }}"
            },
            {
              "key": "Type|select",
              "condition": "equals",
              "selectValue": "Debit"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "matchType": "allFilters",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "82d3a838-5c66-4efe-97f6-c415dd0c62ef",
          "cachedResultUrl": "https://www.notion.so/82d3a8385c664efe97f6c415dd0c62ef",
          "cachedResultName": "Financial Transaction"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c05b1967-a905-48b2-95ef-91f56ae3e6d5",
      "name": "Summarize1",
      "type": "n8n-nodes-base.summarize",
      "position": [
        208,
        96
      ],
      "parameters": {
        "options": {},
        "fieldsToSummarize": {
          "values": [
            {
              "field": "property_cost",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "ab804f06-1741-46f9-b9a5-dd00d7e09a0e",
      "name": "Items to Message1",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        96
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Total Expenses This Week - Rs \" + $input.first().json.sum_property_cost\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "c5edc9b1-13ce-4c1b-978b-8f838b9b55ad",
      "name": "Get Debit Transactions1",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        96
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Created time|created_time",
              "condition": "on_or_after",
              "createdTimeValue": "={{ $now.startOf('week') }}"
            },
            {
              "key": "Type|select",
              "condition": "equals",
              "selectValue": "Debit"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "matchType": "allFilters",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "82d3a838-5c66-4efe-97f6-c415dd0c62ef",
          "cachedResultUrl": "https://www.notion.so/82d3a8385c664efe97f6c415dd0c62ef",
          "cachedResultName": "Financial Transaction"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "73611f07-de84-4b11-ab95-95f0684618d2",
      "name": "Summarize2",
      "type": "n8n-nodes-base.summarize",
      "position": [
        208,
        864
      ],
      "parameters": {
        "options": {},
        "fieldsToSummarize": {
          "values": [
            {
              "field": "property_cost",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "20259ec4-d316-4b53-a3e7-647abb6d5406",
      "name": "Items to Message3",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        864
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Total Expenses This Month - Rs \" + $input.first().json.sum_property_cost\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "d5bca496-0437-4d20-907a-d21a3f54b70c",
      "name": "Get Debit Transactions2",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        864
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Created time|created_time",
              "condition": "on_or_after",
              "createdTimeValue": "={{ $now.startOf('month') }}"
            },
            {
              "key": "Type|select",
              "condition": "equals",
              "selectValue": "Debit"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "matchType": "allFilters",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "82d3a838-5c66-4efe-97f6-c415dd0c62ef",
          "cachedResultUrl": "https://www.notion.so/82d3a8385c664efe97f6c415dd0c62ef",
          "cachedResultName": "Financial Transaction"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "58b9bde1-b170-44f4-83e8-9b2a2228ff3f",
      "name": "Set Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d08d5cbf-95fc-404f-b0e3-88429acb1ba2",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "5b33dc71-88b8-4769-b92b-efb66817af79",
              "name": "budget_left",
              "type": "string",
              "value": "={{ $json.property_monthly_budget_left }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5d20ace4-a9a6-4e79-b24b-0e670a78143e",
      "name": "Items to Message4",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        288
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Monthly Budget Left - \" + $input.all().length + \"\\n\\n\"\nlet index = 1\nfor (const item of $input.all()) {\n  message+=index+\") \"\n  message+=item.json.name + \": \"\n  message+=item.json['budget_left'] +\"\\n\"\n}\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "a48c2cdc-079d-4598-8e90-fd3997e528f6",
      "name": "Get Monthly Budget Left",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        288
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Currently Applicable|checkbox",
              "condition": "equals",
              "checkboxValue": true
            },
            {
              "key": "Payment Schedule Type|select",
              "condition": "equals",
              "selectValue": "=Monthly"
            },
            {
              "key": "Monthly Budget Left|formula",
              "condition": "greater_than",
              "returnType": "number"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "matchType": "allFilters",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "883955ad-add2-421a-bff9-5d51305ab942",
          "cachedResultUrl": "https://www.notion.so/883955adadd2421abff95d51305ab942",
          "cachedResultName": "Budget"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d6240a90-ade6-439f-a840-2f8748da6fcb",
      "name": "Set Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        480
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d08d5cbf-95fc-404f-b0e3-88429acb1ba2",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "5b33dc71-88b8-4769-b92b-efb66817af79",
              "name": "budget_left",
              "type": "string",
              "value": "={{ $json.property_monthly_budget_left }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "14cf0d53-ae71-41f6-aedc-71ad5954bc36",
      "name": "Items to Message5",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        480
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Monthly Budget Spent - \" + $input.all().length + \"\\n\\n\"\nlet index = 1\nfor (const item of $input.all()) {\n  message+=index+\") \"\n  message+=item.json.name + \": \"\n  message+=item.json['budget_left'] +\"\\n\"\n}\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "638a8223-7b89-4ce3-a4c6-61d5e6514c44",
      "name": "Get Monthly Budget Spent",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        480
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Currently Applicable|checkbox",
              "condition": "equals",
              "checkboxValue": true
            },
            {
              "key": "Payment Schedule Type|select",
              "condition": "equals",
              "selectValue": "=Monthly"
            },
            {
              "key": "Monthly Budget Left|formula",
              "condition": "less_than_or_equal_to",
              "returnType": "number"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "matchType": "allFilters",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "883955ad-add2-421a-bff9-5d51305ab942",
          "cachedResultUrl": "https://www.notion.so/883955adadd2421abff95d51305ab942",
          "cachedResultName": "Budget"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "26f59966-bf23-4e32-b886-607206f91a18",
      "name": "Items to Message6",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        -480
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Invoices stil to pay - \" + $input.all().length + \"\\n\\n\"\nlet index = 1\nfor (const item of $input.all()) {\n  message+=index+\") \"\n  message+=item.json.name + \": \"\n  message+=item.json['cost'] +\"\\n\"\n}\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "325404b7-f383-4b66-bee5-205b8d4c1147",
      "name": "Get Invoices",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        -480
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Type|select",
              "condition": "equals",
              "selectValue": "Invoice"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "matchType": "allFilters",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "82d3a838-5c66-4efe-97f6-c415dd0c62ef",
          "cachedResultUrl": "https://www.notion.so/82d3a8385c664efe97f6c415dd0c62ef",
          "cachedResultName": "Financial Transaction"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "43f076fd-1c8f-4770-9cbe-a45adc63f000",
      "name": "Set Fields3",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        -480
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d08d5cbf-95fc-404f-b0e3-88429acb1ba2",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "5b33dc71-88b8-4769-b92b-efb66817af79",
              "name": "cost",
              "type": "string",
              "value": "={{ $json.property_cost }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "beca75b5-5ad1-46c6-8457-e08ad0e9bde5",
      "name": "Set Fields4",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        1056
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d08d5cbf-95fc-404f-b0e3-88429acb1ba2",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "5b33dc71-88b8-4769-b92b-efb66817af79",
              "name": "fund_left",
              "type": "string",
              "value": "={{ $json.property_fund_amount_left }}"
            },
            {
              "id": "29191bf4-e1cc-471a-8c81-da47308854a8",
              "name": "fund_needed",
              "type": "string",
              "value": "={{ $json.property_amount_needed }}"
            },
            {
              "id": "a5298857-32f5-4f4c-ac56-49cb8f3fd510",
              "name": "fund_spent",
              "type": "string",
              "value": "={{ $json.property_amount_spent }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "883649a3-3384-4a63-9ce9-e75792d600f9",
      "name": "Items to Message7",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        1056
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Funds Info - \" + $input.all().length + \"\\n\\n\"\nlet index = 1\nfor (const item of $input.all()) {\n  message+=index+\") \"\n  message+=item.json.name + \": \"\n  message+=item.json['fund_spent'] +\"/\"\n  message+=item.json['fund_needed'] +\"\\n\"\n}\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "7dd8d0a6-b4c2-4164-b81f-6de15bab253e",
      "name": "Fund Amount Left",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        1056
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "92897f3e-b07e-4bd6-83b5-bf80ce4a4dc2",
          "cachedResultUrl": "https://www.notion.so/92897f3eb07e4bd683b5bf80ce4a4dc2",
          "cachedResultName": "Funds"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "cca4deb2-ad08-4641-b342-72e508994cb8",
      "name": "Summarize3",
      "type": "n8n-nodes-base.summarize",
      "position": [
        208,
        672
      ],
      "parameters": {
        "options": {},
        "fieldsToSummarize": {
          "values": [
            {
              "field": "property_cost",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "4f91f0cd-a970-49dc-9b5f-d2b8722d123e",
      "name": "Items to Message8",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        672
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Total Income This Month - Rs \" + $('Get Income This Month').first().json.property_received_amount\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "a3ff443a-633b-4c92-a594-5e39c24f4fec",
      "name": "Get Income This Month",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        672
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Created time|created_time",
              "condition": "on_or_after",
              "createdTimeValue": "={{ $now.startOf('month') }}"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "2501d3fa-a0a0-80c5-b74e-d64686678b0f",
          "cachedResultUrl": "https://www.notion.so/2501d3faa0a080c5b74ed64686678b0f",
          "cachedResultName": "Income"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "5d46d40a-5f1b-4939-a069-77eca3bc0c9c",
      "name": "Summarize4",
      "type": "n8n-nodes-base.summarize",
      "position": [
        208,
        1248
      ],
      "parameters": {
        "options": {},
        "fieldsToSummarize": {
          "values": [
            {
              "field": "property_cost",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "26290c7c-0355-4bbb-9064-cd1e928ff7c1",
      "name": "Items to Message9",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        1248
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Total Income This Month - Rs \" + $('Get Income This Month1').first().json.property_received_amount\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "083e469b-515c-438e-ab51-5bead1c52a89",
      "name": "Get Income This Month1",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        1248
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Created time|created_time",
              "condition": "on_or_after",
              "createdTimeValue": "={{ $now.startOf('month') }}"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "2501d3fa-a0a0-80c5-b74e-d64686678b0f",
          "cachedResultUrl": "https://www.notion.so/2501d3faa0a080c5b74ed64686678b0f",
          "cachedResultName": "Income"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1859ed45-6707-49b8-86c5-d8da1e0a8759",
      "name": "Monthly End Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -336,
        -80
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "months",
              "triggerAtDayOfMonth": 28
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "bef29d0f-2d4a-4549-bf17-ea746b1852ad",
      "name": "Monthly Start Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -336,
        128
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "months"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5f384d75-2f63-46a5-9dc7-aade6e894b32",
      "name": "Get Liquidity",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        1488
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Liquidity|select",
              "condition": "equals",
              "selectValue": "Liquid"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "1ed55e6e-1875-4d55-b1fc-b89fc8b793cf",
          "cachedResultUrl": "https://www.notion.so/1ed55e6e18754d55b1fcb89fc8b793cf",
          "cachedResultName": "Assets and Liabilities"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "24114f8a-bdb4-41cb-8c28-2c64811c0dcb",
      "name": "Set Fields5",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        1488
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d08d5cbf-95fc-404f-b0e3-88429acb1ba2",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "5b33dc71-88b8-4769-b92b-efb66817af79",
              "name": "balance",
              "type": "string",
              "value": "={{ $json.property_balance }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7ffb5927-25e1-44cc-8ec4-9a3b9247f31b",
      "name": "Items to Message10",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        1488
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Liquidity Balance - \" + $input.all().length + \"\\n\\n\"\nlet index = 1\nfor (const item of $input.all()) {\n  message+=index+\") \"\n  message+=item.json.name + \": \"\n  message+=item.json['balance'] +\"\\n\"\n}\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "74ece92b-b5de-477c-a146-d6b3e60073a3",
      "name": "Summarize5",
      "type": "n8n-nodes-base.summarize",
      "position": [
        208,
        1696
      ],
      "parameters": {
        "options": {},
        "fieldsToSummarize": {
          "values": [
            {
              "field": "property_balance",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "4daf9941-f510-41d8-8b3d-53a04ee38d96",
      "name": "Items to Message11",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        1696
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet message = \"Total Semi Liquid Balance Avialable - Rs \" + $input.first().json.sum_property_balance\n\nreturn [{\"message\": message}]"
      },
      "typeVersion": 2
    },
    {
      "id": "299e45f4-a0d5-4b7b-a0af-df797a193e58",
      "name": "Get Semi Liquid",
      "type": "n8n-nodes-base.notion",
      "position": [
        -64,
        1696
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Liquidity|select",
              "condition": "equals",
              "selectValue": "Semi Liquid"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "1ed55e6e-1875-4d55-b1fc-b89fc8b793cf",
          "cachedResultUrl": "https://www.notion.so/1ed55e6e18754d55b1fcb89fc8b793cf",
          "cachedResultName": "Assets and Liabilities"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b5438757-1711-45f5-8c78-cb5b4b173daa",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1680,
        -608
      ],
      "parameters": {
        "width": 1200,
        "height": 896,
        "content": "# Scheduled Telegram Digests from your Personal Finance Notion System\n\n\n### How it works\n- **Schedule Triggers**: Daily, Weekly, Monthly (start & end).\n- **Notion queries** (selected DBs):\n  - **Financial Transaction**: filters on `Created time`, `Type` = `Debit`/`Invoice`.\n  - **Budget**: `Currently Applicable = true`, `Payment Schedule Type = Monthly`, formula: `Monthly Budget Left`.\n  - **Income**: month-to-date `Created time` filter.\n  - **Funds**: reads `Amount Left`, `Amount Spent`, `Amount Needed`.\n  - **Scheduler**: `Next Date` on or before now, `Type = Financial`, `Repeat Type != off`.\n  - **Assets and Liabilities**: `Liquidity` = `Liquid` or `Semi Liquid`.\n- **Summarize nodes**: sum `property_cost` / `property_balance` fields.\n- **Set/Code nodes**: reshape Notion properties (e.g., `property_next_date.start` \u2192 `next-date`) and format text blocks like:\n  - `Total Expenses Today - Rs X`\n  - `Monthly Budget Left - &lt;list&gt;`\n  - `Invoices still to pay - &lt;list&gt;`\n  - `Funds Info - spent/needed`\n  - `Liquidity Balance - &lt;list&gt;`\n- **Telegram**: sends the composed message to `chatId`.\n\n&gt; Tip: If your Notion property names differ, adjust the `filters` and `Set` node mappings accordingly.\n\n### How to set up\n1. **Duplicate the [Personal Finance System Notion template](https://www.notion.so/templates/personal-finance-system)** into your workspace.  \n2. Create a **Telegram Bot** with BotFather \u2192 copy the bot token and your chat ID.  \n3. Create a **Notion Integration Token** and connect it to your duplicated finance databases.  \n4. Add your **Gmail accounts** (`forwarding@`, `support@`, and/or personal Gmail) under **Gmail OAuth2 credentials** in n8n.  \n5. Import the workflow JSON into n8n \u2192 fill in the credential names as listed below:  \n   - `Notion account` \u2192 Notion API  \n   - `Accountant AI` \u2192 Telegram Bot  \n\n### Customization\n- Change the **date ranges**, add **currency symbol**, or swap **summaries** for **tables**.\n- Add more **filters** (labels, categories) to the Notion nodes.\n- Replace Telegram with Slack/Email by swapping the final node.\n- To avoid \u201cexpects dateTime but got object\u201d, convert `$now` to string: `{{$now.toISO()}}` or parse Notion dates with `DateTime.fromISO(...)` as needed."
      },
      "typeVersion": 1
    },
    {
      "id": "b778302d-c992-4ef3-8bb8-aaf4c6125c6b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -608
      ],
      "parameters": {
        "color": 7,
        "width": 224,
        "height": 912,
        "content": "## Step 1 - Trigger"
      },
      "typeVersion": 1
    },
    {
      "id": "03c149bf-ea1d-4f21-9130-ce157e8c7e16",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -608
      ],
      "parameters": {
        "color": 7,
        "height": 2480,
        "content": "## Step 2 - Get Notion Databases"
      },
      "typeVersion": 1
    },
    {
      "id": "3254fee5-6d4c-4243-a81f-932f3294cfdb",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -608
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 2480,
        "content": "## Step 3 - Data Manipulation\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6f997660-a51b-4f35-be79-dbfd03695222",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        -608
      ],
      "parameters": {
        "color": 7,
        "width": 304,
        "height": 320,
        "content": "## Step 4 - Send Message\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "333268a7-2864-4e90-8ba8-dd7505749770",
  "connections": {
    "Summarize": {
      "main": [
        [
          {
            "node": "Items to Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Fields": {
      "main": [
        [
          {
            "node": "Items to Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize1": {
      "main": [
        [
          {
            "node": "Items to Message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize2": {
      "main": [
        [
          {
            "node": "Items to Message3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize3": {
      "main": [
        [
          {
            "node": "Items to Message8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize4": {
      "main": [
        [
          {
            "node": "Items to Message9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize5": {
      "main": [
        [
          {
            "node": "Items to Message11",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Fields1": {
      "main": [
        [
          {
            "node": "Items to Message5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Fields2": {
      "main": [
        [
          {
            "node": "Items to Message2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Fields3": {
      "main": [
        [
          {
            "node": "Items to Message6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Fields4": {
      "main": [
        [
          {
            "node": "Items to Message7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Fields5": {
      "main": [
        [
          {
            "node": "Items to Message10",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Invoices": {
      "main": [
        [
          {
            "node": "Set Fields3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Trigger": {
      "main": [
        [
          {
            "node": "Get Debit Transactions",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Invoices",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Liquidity": {
      "main": [
        [
          {
            "node": "Set Fields5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Trigger": {
      "main": [
        [
          {
            "node": "Get Debit Transactions1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Financial Obligations",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Monthly Budget Left",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Monthly Budget Spent",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Income This Month",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Semi Liquid": {
      "main": [
        [
          {
            "node": "Summarize5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fund Amount Left": {
      "main": [
        [
          {
            "node": "Set Fields4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message1": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message2": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message3": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message4": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message5": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message6": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message7": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message8": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message9": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message10": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Items to Message11": {
      "main": [
        [
          {
            "node": "Send Message4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monthly End Trigger": {
      "main": [
        [
          {
            "node": "Get Debit Transactions2",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fund Amount Left",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Income This Month1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Income This Month": {
      "main": [
        [
          {
            "node": "Summarize3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monthly Start Trigger": {
      "main": [
        [
          {
            "node": "Get Liquidity",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Semi Liquid",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Debit Transactions": {
      "main": [
        [
          {
            "node": "Summarize",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Income This Month1": {
      "main": [
        [
          {
            "node": "Summarize4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Debit Transactions1": {
      "main": [
        [
          {
            "node": "Summarize1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Debit Transactions2": {
      "main": [
        [
          {
            "node": "Summarize2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Monthly Budget Left": {
      "main": [
        [
          {
            "node": "Set Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Monthly Budget Spent": {
      "main": [
        [
          {
            "node": "Set Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Financial Obligations": {
      "main": [
        [
          {
            "node": "Set Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}