{ "name": "Telegram Assistant - Router", "nodes": [ { "parameters": { "httpMethod": "POST", "path": "79209f6f-28f3-4782-8366-2517e47adc0e", "responseMode": "responseNode", "options": {} }, "id": "webhook-router-1", "name": "Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 1, "position": [240, 300], "webhookId": "79209f6f-28f3-4782-8366-2517e47adc0e" }, { "parameters": { "mode": "rules", "rules": { "rules": [ { "operation": "equal", "value1": "={{ $json.command }}", "value2": "/start" }, { "operation": "equal", "value1": "={{ $json.command }}", "value2": "/help" }, { "operation": "equal", "value1": "={{ $json.command }}", "value2": "/deck" }, { "operation": "equal", "value1": "={{ $json.command }}", "value2": "/email" }, { "operation": "equal", "value1": "={{ $json.command }}", "value2": "/ask" } ] }, "fallbackOutput": "extra" }, "id": "switch-command-1", "name": "Route Command", "type": "n8n-nodes-base.switch", "typeVersion": 1, "position": [460, 300] }, { "parameters": { "respondWith": "json", "responseBody": "={{ JSON.stringify({chatId: $json.chatId, text: \"šŸ‘‹ Welcome to your Telegram Assistant!\\n\\nI can help you with:\\n\\nšŸ“‹ /deck - Manage Nextcloud Deck tasks\\nšŸ“§ /email - Search your emails\\nšŸ’¬ /ask - Chat with AI\\nā“ /help - Show this message\\n\\nOr just chat naturally - I understand!\", parseMode: 'Markdown'}) }}" }, "id": "respond-start-1", "name": "Respond Start", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [680, 100] }, { "parameters": { "respondWith": "json", "responseBody": "={{ JSON.stringify({chatId: $json.chatId, text: \"šŸ¤– *Telegram Assistant Help*\\n\\nšŸ“‹ *Deck:*\\n /deck add \\n Or: 'add a deck called cleaning'\\n\\nšŸ“§ *Email:*\\n /email search \\n Or: 'find my train ticket'\\n\\nšŸ’¬ *AI:*\\n /ask \\n Or: 'what's the weather?'\", parseMode: 'Markdown'}) }}" }, "id": "respond-help-1", "name": "Respond Help", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [680, 200] }, { "parameters": { "url": "=https://flow.egonetix.de/webhook/c1294640-f15e-411e-b38b-8b69b8419bce", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify($json) }}", "options": {} }, "id": "call-deck-1", "name": "Call Deck Workflow", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [680, 300] }, { "parameters": { "url": "=https://flow.egonetix.de/webhook/telegram-email", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify($json) }}", "options": {} }, "id": "call-email-1", "name": "Call Email Workflow", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [680, 400] }, { "parameters": { "url": "=https://flow.egonetix.de/webhook/4e0e30c5-2360-49e5-a37c-e2558f811341", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify($json) }}", "options": {} }, "id": "call-ai-1", "name": "Call AI Workflow", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [680, 500] }, { "parameters": { "respondWith": "json", "responseBody": "={{ JSON.stringify({chatId: $json.chatId, text: \"āŒ Unknown command: \" + $json.command + \"\\n\\nType /help to see available commands.\"}) }}" }, "id": "respond-unknown-1", "name": "Respond Unknown", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [680, 600] }, { "parameters": { "chatId": "={{ $json.chatId }}", "text": "={{ $json.text }}", "additionalFields": {"parse_mode": "={{ $json.parseMode || 'HTML' }}"} }, "id": "send-telegram-1", "name": "Send Telegram Response", "type": "n8n-nodes-base.telegram", "typeVersion": 1.1, "position": [900, 300], "credentials": { "telegramApi": { "id": "6Rim8odDFpQoHxCM", "name": "mortimer" } } }, { "parameters": { "respondWith": "json", "responseBody": "={{ JSON.stringify({ success: true }) }}" }, "id": "respond-ok-1", "name": "Respond OK", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [1120, 300] } ], "connections": { "Webhook": {"main": [[{"node": "Route Command", "type": "main", "index": 0}]]}, "Route Command": {"main": [[{"node": "Respond Start", "type": "main", "index": 0}], [{"node": "Respond Help", "type": "main", "index": 0}], [{"node": "Call Deck Workflow", "type": "main", "index": 0}], [{"node": "Call Email Workflow", "type": "main", "index": 0}], [{"node": "Call AI Workflow", "type": "main", "index": 0}], [{"node": "Respond Unknown", "type": "main", "index": 0}]]}, "Respond Start": {"main": [[{"node": "Send Telegram Response", "type": "main", "index": 0}]]}, "Respond Help": {"main": [[{"node": "Send Telegram Response", "type": "main", "index": 0}]]}, "Call Deck Workflow": {"main": [[{"node": "Send Telegram Response", "type": "main", "index": 0}]]}, "Call Email Workflow": {"main": [[{"node": "Send Telegram Response", "type": "main", "index": 0}]]}, "Call AI Workflow": {"main": [[{"node": "Send Telegram Response", "type": "main", "index": 0}]]}, "Respond Unknown": {"main": [[{"node": "Send Telegram Response", "type": "main", "index": 0}]]}, "Send Telegram Response": {"main": [[{"node": "Respond OK", "type": "main", "index": 0}]]} }, "settings": {} }