- Add ULTIMATE-Telegram-CMS-COMPLETE.json with all commands - Add Docker Event workflows with Gitea integration - Add comprehensive deployment guide for fresh installs - Add quick reference and testing checklist - Include all n8n workflow exports Commands: /start, /list, /search, /stats, /preview, /publish, /delete, .review Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
182 lines
6.9 KiB
JSON
182 lines
6.9 KiB
JSON
{
|
|
"name": "🎯 ULTIMATE Telegram CMS",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"updates": ["message"],
|
|
"additionalFields": {}
|
|
},
|
|
"type": "n8n-nodes-base.telegramTrigger",
|
|
"typeVersion": 1.2,
|
|
"position": [0, 0],
|
|
"id": "telegram-trigger",
|
|
"name": "Telegram Trigger"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const text = $input.first().json.message?.text ?? '';\nconst chatId = $input.first().json.message?.chat?.id;\nlet match;\n\n// /start - Dashboard\nif (text === '/start') {\n return [{ json: { action: 'start', chatId } }];\n}\n\n// /list projects|books\nmatch = text.match(/^\\/list\\s+(projects|books)/);\nif (match) {\n return [{ json: { action: 'list', type: match[1], chatId } }];\n}\n\n// /search <term>\nmatch = text.match(/^\\/search\\s+(.+)/);\nif (match) {\n return [{ json: { action: 'search', query: match[1], chatId } }];\n}\n\n// /stats\nif (text === '/stats') {\n return [{ json: { action: 'stats', chatId } }];\n}\n\n// /preview <ID>\nmatch = text.match(/^\\/preview\\s+(\\d+)/);\nif (match) {\n return [{ json: { action: 'preview', id: match[1], chatId } }];\n}\n\n// /publish <ID> or /publishproject<ID> or /publishbook<ID>\nmatch = text.match(/^\\/publish(?:project|book)?(\\d+)/);\nif (match) {\n return [{ json: { action: 'publish', id: match[1], chatId } }];\n}\n\n// /delete <ID> or /deleteproject<ID> or /deletebook<ID>\nmatch = text.match(/^\\/delete(?:project|book)?(\\d+)/);\nif (match) {\n return [{ json: { action: 'delete', id: match[1], chatId } }];\n}\n\n// /deletereview<ID>\nmatch = text.match(/^\\/deletereview(\\d+)/);\nif (match) {\n return [{ json: { action: 'delete_review', id: match[1], chatId } }];\n}\n\n// .review <HC_ID> <RATING> <ANSWERS>\nif (text.startsWith('.review') || text.startsWith('/review')) {\n const rest = text.replace(/^[\\.\/]review/, '').trim();\n match = rest.match(/^([0-9]+)\\s+([0-9]+)\\s+(.+)/);\n if (match) {\n return [{ json: { action: 'create_review', hardcoverId: match[1], rating: parseInt(match[2]), answers: match[3], chatId } }];\n }\n}\n\n// Unknown\nreturn [{ json: { action: 'unknown', chatId, text } }];"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [220, 0],
|
|
"id": "parse-command",
|
|
"name": "Parse Command"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"rules": {
|
|
"values": [
|
|
{
|
|
"conditions": {
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.action }}",
|
|
"rightValue": "start",
|
|
"operator": { "type": "string", "operation": "equals" }
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "start"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.action }}",
|
|
"rightValue": "list",
|
|
"operator": { "type": "string", "operation": "equals" }
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "list"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.action }}",
|
|
"rightValue": "search",
|
|
"operator": { "type": "string", "operation": "equals" }
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "search"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.action }}",
|
|
"rightValue": "stats",
|
|
"operator": { "type": "string", "operation": "equals" }
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "stats"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.action }}",
|
|
"rightValue": "preview",
|
|
"operator": { "type": "string", "operation": "equals" }
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "preview"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.action }}",
|
|
"rightValue": "publish",
|
|
"operator": { "type": "string", "operation": "equals" }
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "publish"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.action }}",
|
|
"rightValue": "delete",
|
|
"operator": { "type": "string", "operation": "equals" }
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "delete"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.action }}",
|
|
"rightValue": "delete_review",
|
|
"operator": { "type": "string", "operation": "equals" }
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "delete_review"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.action }}",
|
|
"rightValue": "create_review",
|
|
"operator": { "type": "string", "operation": "equals" }
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "create_review"
|
|
},
|
|
{
|
|
"conditions": {
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.action }}",
|
|
"rightValue": "unknown",
|
|
"operator": { "type": "string", "operation": "equals" }
|
|
}
|
|
]
|
|
},
|
|
"renameOutput": true,
|
|
"outputKey": "unknown"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.switch",
|
|
"typeVersion": 3.2,
|
|
"position": [440, 0],
|
|
"id": "switch-action",
|
|
"name": "Switch Action"
|
|
}
|
|
],
|
|
"connections": {
|
|
"Telegram Trigger": {
|
|
"main": [[{ "node": "Parse Command", "type": "main", "index": 0 }]]
|
|
},
|
|
"Parse Command": {
|
|
"main": [[{ "node": "Switch Action", "type": "main", "index": 0 }]]
|
|
}
|
|
},
|
|
"active": true,
|
|
"settings": {
|
|
"executionOrder": "v1"
|
|
}
|
|
}
|