From 9d503bb9a86db361fe9fa5ef970b3fb2368cadcd Mon Sep 17 00:00:00 2001 From: Lucas Berger Date: Wed, 28 Jan 2026 19:47:39 -0500 Subject: [PATCH] feat(01-01): create n8n workflow for telegram echo bot - Telegram Trigger node listens for messages - IF node authenticates via $env.TELEGRAM_USER_ID - Code node formats echo with timestamp - Telegram Send node replies to authorized users - False branch has no connections (silent ignore) --- n8n-workflow.json | 126 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 n8n-workflow.json diff --git a/n8n-workflow.json b/n8n-workflow.json new file mode 100644 index 0000000..7de5f26 --- /dev/null +++ b/n8n-workflow.json @@ -0,0 +1,126 @@ +{ + "name": "Docker Manager Bot", + "nodes": [ + { + "parameters": { + "updates": ["message"] + }, + "id": "telegram-trigger", + "name": "Telegram Trigger", + "type": "n8n-nodes-base.telegramTrigger", + "typeVersion": 1.1, + "position": [240, 300], + "credentials": { + "telegramApi": { + "id": "telegram-credential", + "name": "Telegram API" + } + } + }, + { + "parameters": { + "conditions": { + "options": { + "caseSensitive": true, + "leftValue": "", + "typeValidation": "strict" + }, + "conditions": [ + { + "id": "user-auth-condition", + "leftValue": "={{ $json.message.from.id.toString() }}", + "rightValue": "={{ $env.TELEGRAM_USER_ID }}", + "operator": { + "type": "string", + "operation": "equals" + } + } + ], + "combinator": "and" + }, + "options": {} + }, + "id": "if-auth", + "name": "IF User Authenticated", + "type": "n8n-nodes-base.if", + "typeVersion": 2, + "position": [460, 300] + }, + { + "parameters": { + "jsCode": "const message = $input.item.json.message;\nconst timestamp = new Date().toISOString();\nconst text = message.text || '(no text)';\n\nreturn {\n json: {\n chatId: message.chat.id,\n text: `Got: ${text}\\n\\nProcessed: ${timestamp}`\n }\n};" + }, + "id": "code-format-echo", + "name": "Format Echo", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [680, 240] + }, + { + "parameters": { + "resource": "message", + "operation": "sendMessage", + "chatId": "={{ $json.chatId }}", + "text": "={{ $json.text }}", + "additionalFields": { + "parse_mode": "HTML" + } + }, + "id": "telegram-send", + "name": "Send Echo", + "type": "n8n-nodes-base.telegram", + "typeVersion": 1.2, + "position": [900, 240], + "credentials": { + "telegramApi": { + "id": "telegram-credential", + "name": "Telegram API" + } + } + } + ], + "connections": { + "Telegram Trigger": { + "main": [ + [ + { + "node": "IF User Authenticated", + "type": "main", + "index": 0 + } + ] + ] + }, + "IF User Authenticated": { + "main": [ + [ + { + "node": "Format Echo", + "type": "main", + "index": 0 + } + ], + [] + ] + }, + "Format Echo": { + "main": [ + [ + { + "node": "Send Echo", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "pinData": {}, + "settings": { + "executionOrder": "v1" + }, + "staticData": null, + "tags": [], + "triggerCount": 1, + "active": false +}