{"active":false,"connections":{"AI Agent":{"main":[[{"index":0,"node":"Send Reply","type":"main"}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"index":0,"node":"AI Agent","type":"ai_languageModel"}]]},"Telegram Trigger":{"main":[[{"index":0,"node":"AI Agent","type":"main"}]]},"Window Buffer Memory":{"ai_memory":[[{"index":0,"node":"AI Agent","type":"ai_memory"}]]}},"meta":{"instanceId":"","templateCredsSetupCompleted":false},"name":"Telegram Personal AI Assistant","nodes":[{"credentials":{"telegramApi":{"id":"","name":"Telegram Bot API"}},"id":"a1b2c3d4-0001-4a5b-8c9d-111111111111","name":"Telegram Trigger","parameters":{"additionalFields":{},"updates":["message"]},"position":[240,300],"type":"n8n-nodes-base.telegramTrigger","typeVersion":1.2,"webhookId":"cortexflow-telegram-assistant"},{"id":"a1b2c3d4-0002-4a5b-8c9d-222222222222","name":"AI Agent","parameters":{"options":{"systemMessage":"You are a helpful personal AI assistant chatting over Telegram. Keep replies concise (under 300 words unless asked for more), friendly, and formatted for Telegram (plain text, short paragraphs). If the user asks something you cannot do, say so plainly."},"promptType":"define","text":"={{ $json.message.text }}"},"position":[480,300],"type":"@n8n/n8n-nodes-langchain.agent","typeVersion":2.2},{"credentials":{"openAiApi":{"id":"","name":"OpenAI API"}},"id":"a1b2c3d4-0003-4a5b-8c9d-333333333333","name":"OpenAI Chat Model","parameters":{"model":{"__rl":true,"cachedResultName":"gpt-4o-mini","mode":"list","value":"gpt-4o-mini"},"options":{}},"position":[480,500],"type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","typeVersion":1.2},{"id":"a1b2c3d4-0004-4a5b-8c9d-444444444444","name":"Window Buffer Memory","parameters":{"contextWindowLength":10,"sessionIdType":"customKey","sessionKey":"={{ $json.message.chat.id }}"},"position":[700,500],"type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","typeVersion":1.3},{"credentials":{"telegramApi":{"id":"","name":"Telegram Bot API"}},"id":"a1b2c3d4-0005-4a5b-8c9d-555555555555","name":"Send Reply","parameters":{"additionalFields":{},"chatId":"={{ $('Telegram Trigger').item.json.message.chat.id }}","text":"={{ $json.output }}"},"position":[720,300],"type":"n8n-nodes-base.telegram","typeVersion":1.2},{"id":"a1b2c3d4-0006-4a5b-8c9d-666666666666","name":"Sticky Note","parameters":{"color":4,"content":"## Telegram Personal AI Assistant\n\n**Setup (5 min):**\n1. Create a bot with @BotFather on Telegram, copy the token.\n2. In n8n: create a **Telegram** credential with that token, select it in *Telegram Trigger* and *Send Reply*.\n3. Create an **OpenAI** credential, select it in *OpenAI Chat Model*.\n4. Activate the workflow and send your bot a message.\n\n**How it works:** Telegram Trigger → AI Agent (OpenAI + per-chat memory) → reply sent back to the same chat.","height":300,"width":420},"position":[160,-80],"type":"n8n-nodes-base.stickyNote","typeVersion":1}],"pinData":{},"settings":{"executionOrder":"v1"},"tags":[{"name":"cortexflow-template"}],"versionId":"cortexflow-telegram-ai-assistant-v1"}