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
This commit is contained in:
Lucas Berger
2026-01-30 08:40:15 -05:00
parent 87d34b1a15
commit 2cbf6e7ec7
+123 -6
View File
@@ -3,7 +3,7 @@
"nodes": [ "nodes": [
{ {
"parameters": { "parameters": {
"updates": ["message"] "updates": ["message", "callback_query"]
}, },
"id": "telegram-trigger", "id": "telegram-trigger",
"name": "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": { "parameters": {
"conditions": { "conditions": {
@@ -44,7 +108,36 @@
"name": "IF User Authenticated", "name": "IF User Authenticated",
"type": "n8n-nodes-base.if", "type": "n8n-nodes-base.if",
"typeVersion": 2, "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": { "parameters": {
@@ -124,7 +217,7 @@
"name": "Route Message", "name": "Route Message",
"type": "n8n-nodes-base.switch", "type": "n8n-nodes-base.switch",
"typeVersion": 3.2, "typeVersion": 3.2,
"position": [680, 300] "position": [900, 200]
}, },
{ {
"parameters": { "parameters": {
@@ -135,7 +228,7 @@
"name": "Docker List Containers", "name": "Docker List Containers",
"type": "n8n-nodes-base.executeCommand", "type": "n8n-nodes-base.executeCommand",
"typeVersion": 1, "typeVersion": 1,
"position": [900, 200] "position": [1120, 100]
}, },
{ {
"parameters": { "parameters": {
@@ -145,7 +238,7 @@
"name": "Parse and Match", "name": "Parse and Match",
"type": "n8n-nodes-base.code", "type": "n8n-nodes-base.code",
"typeVersion": 2, "typeVersion": 2,
"position": [1120, 200] "position": [1340, 100]
}, },
{ {
"parameters": { "parameters": {
@@ -155,7 +248,7 @@
"name": "Format Response", "name": "Format Response",
"type": "n8n-nodes-base.code", "type": "n8n-nodes-base.code",
"typeVersion": 2, "typeVersion": 2,
"position": [1340, 200] "position": [1560, 100]
}, },
{ {
"parameters": { "parameters": {
@@ -492,6 +585,17 @@
], ],
"connections": { "connections": {
"Telegram Trigger": { "Telegram Trigger": {
"main": [
[
{
"node": "Route Update Type",
"type": "main",
"index": 0
}
]
]
},
"Route Update Type": {
"main": [ "main": [
[ [
{ {
@@ -499,6 +603,13 @@
"type": "main", "type": "main",
"index": 0 "index": 0
} }
],
[
{
"node": "IF Callback Authenticated",
"type": "main",
"index": 0
}
] ]
] ]
}, },
@@ -514,6 +625,12 @@
[] []
] ]
}, },
"IF Callback Authenticated": {
"main": [
[],
[]
]
},
"Route Message": { "Route Message": {
"main": [ "main": [
[ [