From 2cbf6e7ec7ef0a434c2fc5705945d185b38308a1 Mon Sep 17 00:00:00 2001 From: Lucas Berger Date: Fri, 30 Jan 2026 08:40:15 -0500 Subject: [PATCH] feat(03-02): configure Telegram Trigger for callback queries - Update Telegram Trigger to receive both message and callback_query updates - Add Route Update Type switch to route messages vs callbacks - Add IF Callback Authenticated node for callback query auth - Restructure connections: message flow through auth, callback through separate auth --- n8n-workflow.json | 129 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 123 insertions(+), 6 deletions(-) diff --git a/n8n-workflow.json b/n8n-workflow.json index 0d39911..0761908 100644 --- a/n8n-workflow.json +++ b/n8n-workflow.json @@ -3,7 +3,7 @@ "nodes": [ { "parameters": { - "updates": ["message"] + "updates": ["message", "callback_query"] }, "id": "telegram-trigger", "name": "Telegram Trigger", @@ -17,6 +17,70 @@ } } }, + { + "parameters": { + "rules": { + "values": [ + { + "id": "route-message", + "conditions": { + "options": { + "caseSensitive": true, + "leftValue": "", + "typeValidation": "loose" + }, + "conditions": [ + { + "id": "has-message", + "leftValue": "={{ $json.message }}", + "rightValue": "", + "operator": { + "type": "object", + "operation": "notEmpty" + } + } + ], + "combinator": "and" + }, + "renameOutput": true, + "outputKey": "message" + }, + { + "id": "route-callback", + "conditions": { + "options": { + "caseSensitive": true, + "leftValue": "", + "typeValidation": "loose" + }, + "conditions": [ + { + "id": "has-callback", + "leftValue": "={{ $json.callback_query }}", + "rightValue": "", + "operator": { + "type": "object", + "operation": "notEmpty" + } + } + ], + "combinator": "and" + }, + "renameOutput": true, + "outputKey": "callback_query" + } + ] + }, + "options": { + "fallbackOutput": "none" + } + }, + "id": "switch-update-type", + "name": "Route Update Type", + "type": "n8n-nodes-base.switch", + "typeVersion": 3.2, + "position": [460, 300] + }, { "parameters": { "conditions": { @@ -44,7 +108,36 @@ "name": "IF User Authenticated", "type": "n8n-nodes-base.if", "typeVersion": 2, - "position": [460, 300] + "position": [680, 200] + }, + { + "parameters": { + "conditions": { + "options": { + "caseSensitive": true, + "leftValue": "", + "typeValidation": "strict" + }, + "conditions": [ + { + "id": "callback-auth-condition", + "leftValue": "={{ $json.callback_query.from.id.toString() }}", + "rightValue": "563878771", + "operator": { + "type": "string", + "operation": "equals" + } + } + ], + "combinator": "and" + }, + "options": {} + }, + "id": "if-callback-auth", + "name": "IF Callback Authenticated", + "type": "n8n-nodes-base.if", + "typeVersion": 2, + "position": [680, 500] }, { "parameters": { @@ -124,7 +217,7 @@ "name": "Route Message", "type": "n8n-nodes-base.switch", "typeVersion": 3.2, - "position": [680, 300] + "position": [900, 200] }, { "parameters": { @@ -135,7 +228,7 @@ "name": "Docker List Containers", "type": "n8n-nodes-base.executeCommand", "typeVersion": 1, - "position": [900, 200] + "position": [1120, 100] }, { "parameters": { @@ -145,7 +238,7 @@ "name": "Parse and Match", "type": "n8n-nodes-base.code", "typeVersion": 2, - "position": [1120, 200] + "position": [1340, 100] }, { "parameters": { @@ -155,7 +248,7 @@ "name": "Format Response", "type": "n8n-nodes-base.code", "typeVersion": 2, - "position": [1340, 200] + "position": [1560, 100] }, { "parameters": { @@ -492,6 +585,17 @@ ], "connections": { "Telegram Trigger": { + "main": [ + [ + { + "node": "Route Update Type", + "type": "main", + "index": 0 + } + ] + ] + }, + "Route Update Type": { "main": [ [ { @@ -499,6 +603,13 @@ "type": "main", "index": 0 } + ], + [ + { + "node": "IF Callback Authenticated", + "type": "main", + "index": 0 + } ] ] }, @@ -514,6 +625,12 @@ [] ] }, + "IF Callback Authenticated": { + "main": [ + [], + [] + ] + }, "Route Message": { "main": [ [