{
  "name": "Notion Assistant",
  "nodes": [
    {
      "id": "89bf8d98-4595-41d8-9930-32ba5f2f9715",
      "name": "Google Calendar",
      "type": "n8n-nodes-base.googleCalendarTool",
      "disabled": true,
      "position": [
        2976,
        1120
      ],
      "parameters": {
        "options": {
          "fields": "=items(summary, start(dateTime))",
          "timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', ``, 'string') }}",
          "timeMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('After', ``, 'string') }}"
        },
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "=<insert email here>"
        },
        "operation": "getAll"
      },
      "typeVersion": 1.1
    },
    {
      "id": "d6ce2a5c-24cd-4c72-9f1d-33c999127b37",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1648,
        1088
      ],
      "parameters": {
        "sessionKey": "={{ $('Listen for incoming events').first().json.message.from.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.2
    },
    {
      "id": "e2922313-4947-45e4-811c-e3fcf1e2cdef",
      "name": "Get Email",
      "type": "n8n-nodes-base.gmailTool",
      "disabled": true,
      "position": [
        2656,
        1120
      ],
      "parameters": {
        "limit": 20,
        "filters": {
          "labelIds": [
            "INBOX"
          ],
          "readStatus": "unread",
          "receivedAfter": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Received_After', ``, 'string') }}",
          "receivedBefore": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Received_Before', ``, 'string') }}"
        },
        "operation": "getAll"
      },
      "typeVersion": 2.1
    },
    {
      "id": "d92c4391-f8ff-4bb9-8d19-5a1bc3b27af9",
      "name": "Listen for incoming events",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        736,
        608
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "id": "3e453427-3464-4270-ae86-1a222ff70da4",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueErrorOutput",
      "position": [
        2224,
        544
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Listen for incoming events').first().json.message.from.id }}",
        "additionalFields": {
          "parse_mode": "Markdown",
          "appendAttribution": false
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "604f47ce-4c8a-4f3b-8ff5-bdc078bc5abc",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        1184,
        560
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a0bf9719-4272-46f6-ab3b-eda6f7b44fd8",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.text }}",
              "rightValue": ""
            },
            {
              "id": "6cba41d1-c89b-4879-b270-b3423ba52822",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": false
    },
    {
      "id": "d065581c-853c-48a9-8416-a2a8e576f17f",
      "name": "Voice or Text",
      "type": "n8n-nodes-base.set",
      "position": [
        1040,
        560
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "text",
              "stringValue": "={{ $json?.message?.text || \"\" }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "1fde4e34-a8f7-48ac-aa6f-d9e403cc7d4f",
      "name": "Get Voice File",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1344,
        560
      ],
      "parameters": {
        "fileId": "={{ $('Listen for incoming events').item.json.message.voice.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "e7c8ce38-701c-4b5b-8af0-0c3e78388c99",
      "name": "Send Email",
      "type": "n8n-nodes-base.gmailTool",
      "disabled": true,
      "position": [
        2816,
        1120
      ],
      "parameters": {
        "sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', `Please format this nicely in html`, 'string') }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "92f504a7-7b49-43bb-b8f7-eb548657b9be",
      "name": "Create a page in Notion",
      "type": "n8n-nodes-base.notionTool",
      "position": [
        2096,
        1072
      ],
      "parameters": {
        "title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', ``, 'string') }}",
        "pageId": {
          "__rl": true,
          "mode": "url",
          "value": "https://www.notion.so/To-Do-List-276a713fd2008042826de9258a4b9637"
        },
        "simple": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Simplify', ``, 'boolean') }}",
        "options": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "44c58a47-fe5a-4dca-aeda-1e2807d0930b",
      "name": "Search a page in Notion",
      "type": "n8n-nodes-base.notionTool",
      "position": [
        2304,
        1072
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Search_Text', ``, 'string') }}",
        "options": {},
        "operation": "search",
        "returnAll": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "08765f57-adb1-4c86-8cc9-1e10437af4a9",
      "name": "Tard, AI Assistant",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1792,
        544
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "=You are my personal assistant. Your name is Tard.\n\nToday’s date is:\n{{ $today.format('yyyy-MM-dd') }}\n\nScope of responsibility:\nYou work exclusively with Notion.\n\nYour main focus:\nManaging and reading a Todo List.\n\nYou work with pages, tasks, and data stored in Notion only.\nYou do NOT have access to email or calendars and must ignore them completely.\n\nNotion guidelines:\n- When presenting tasks, filter and show only what is relevant to the request\n- If no date is specified, assume the user means today\n- Be clear, short, and well structured\n- Do not invent information that does not exist in Notion\n- Always include a Notion link when answering questions about Notion content\n\nGeneral questions:\nYou may also answer general AI questions not related to Notion, such as:\n- History\n- Nutrition (e.g. calories in food)\n- General knowledge\n- Simple explanations of various topics\n\nBehavior rules:\n- Use a natural, informal tone\n- Be helpful, focused, and not verbose\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "14ca2fc6-5eea-4d22-8ad7-12999470c3d0",
      "name": "Transcribe a recording",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1488,
        560
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "typeVersion": 2
    },
    {
      "id": "2fb3659e-7caa-4882-bcbe-31693015b322",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1424,
        1088
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "80d0f7ec-bfc7-4849-be1e-0e89352104d4",
      "name": "Sticky - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 284,
        "content": "## How it works\n\nThis workflow turns Telegram messages (text or voice) into actions in Notion.\nUsers can send a message to a Telegram bot, and the workflow will:\n• Convert voice messages to text using OpenAI\n• Keep short conversational context\n• Use an AI agent to read, search, and create tasks in Notion\n• Reply back to the user in Telegram with clear, formatted results\n\nThe assistant is focused on managing a Todo List in Notion.\nIt does not interact with email or calendars, even if nodes exist for future expansion."
      },
      "typeVersion": 1
    },
    {
      "id": "cb8e96c1-889b-4596-ae27-16c2dce6f71d",
      "name": "Sticky - Telegram Input",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        416
      ],
      "parameters": {
        "color": 3,
        "width": 248,
        "height": 374,
        "content": "## Telegram Input\n\nReceives incoming Telegram messages.\nRoutes text vs. voice messages to the correct processing path."
      },
      "typeVersion": 1
    },
    {
      "id": "8dcb6150-9a07-4dbc-ba98-b655dd4aa342",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "Sticky - Voice to Text",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 weblane",
      "creator": "weblane",
      "position": [
        1008,
        416
      ],
      "parameters": {
        "color": 3,
        "width": 632,
        "height": 326,
        "content": "## Voice to Text\n\nDownloads Telegram voice messages and converts them into text using OpenAI."
      },
      "typeVersion": 1
    },
    {
      "id": "3b6cc3ea-0f1d-485d-868d-609f06711ac9",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "Sticky - Conversation Memory",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 weblane",
      "creator": "weblane",
      "position": [
        1328,
        864
      ],
      "parameters": {
        "color": 3,
        "width": 472,
        "height": 374,
        "content": "## Conversation Memory\n\nStores recent messages so the assistant can stay on topic during short conversations."
      },
      "typeVersion": 1
    },
    {
      "id": "ab57e9d8-b0d5-4718-90bb-73590690563c",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "Sticky - AI Assistant",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 weblane",
      "creator": "weblane",
      "position": [
        1744,
        368
      ],
      "parameters": {
        "color": 3,
        "width": 336,
        "height": 320,
        "content": "## AI Assistant\n\nUnderstands user requests and decides when to search or create tasks in Notion.\nThe agent is strictly focused on Todo management."
      },
      "typeVersion": 1
    },
    {
      "id": "801578c6-02f2-4061-a277-935adf32426d",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "Sticky - Notion Integration",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 weblane",
      "creator": "weblane",
      "position": [
        1952,
        944
      ],
      "parameters": {
        "color": 3,
        "width": 560,
        "height": 294,
        "content": "## Notion Integration\n\nCreates and searches tasks and pages inside Notion based on the user request."
      },
      "typeVersion": 1
    },
    {
      "id": "fd445769-1646-462c-ac56-98146cf14241",
      "name": "Sticky - Reply to User",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2128,
        368
      ],
      "parameters": {
        "color": 3,
        "width": 312,
        "height": 326,
        "content": "## Reply to User\n\nSends the assistant’s response back to Telegram in a clean, readable format."
      },
      "typeVersion": 1
    },
    {
      "id": "ad99f8b9-9b3a-4833-9847-a27fb91231d3",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "Sticky - Optional Integrations",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 weblane",
      "creator": "weblane",
      "position": [
        2560,
        928
      ],
      "parameters": {
        "color": 3,
        "width": 560,
        "height": 378,
        "content": "## Optional Integrations\n\nGmail and Google Calendar nodes are disabled by default.\nEnable and configure them only if you want to extend the workflow beyond Notion."
      },
      "typeVersion": 1
    },
    {
      "id": "ef8587f2-203f-47fa-8e2e-1a9ab1471a7c",
      "name": "Sticky - Credit",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1312,
        256
      ],
      "parameters": {
        "color": 3,
        "width": 340,
        "height": 120,
        "content": "### Credit\nBuilt / customized by **weblane.co.il**"
      },
      "typeVersion": 1
    },
    {
      "id": "c345136a-8356-48b0-8425-934f0f9fd173",
      "name": "Sticky - Overview1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1408,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 220,
        "content": "## Setup steps\n\n1. Create a Telegram bot and connect it to the Telegram Trigger node\n2. Add your OpenAI API key (used for voice transcription and the AI agent)\n3. Connect your Notion account and update the Page/Database URL\n4. (Optional) Enable Gmail or Google Calendar nodes if you plan to extend the workflow\n5. Activate the workflow and start chatting with the bot\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Get Voice File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Tard, AI Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Email": {
      "ai_tool": [
        [
          {
            "node": "Tard, AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send Email": {
      "ai_tool": [
        [
          {
            "node": "Tard, AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Voice or Text": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Voice File": {
      "main": [
        [
          {
            "node": "Transcribe a recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "Tard, AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Tard, AI Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Tard, AI Assistant": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "Tard, AI Assistant",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe a recording": {
      "main": [
        [
          {
            "node": "Tard, AI Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a page in Notion": {
      "ai_tool": [
        [
          {
            "node": "Tard, AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Search a page in Notion": {
      "ai_tool": [
        [
          {
            "node": "Tard, AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Listen for incoming events": {
      "main": [
        [
          {
            "node": "Voice or Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false
}
