8
n8n 中文网amn8n.com

Telegram-n8n-指挥官

高级

这是一个DevOps, AI领域的自动化工作流,包含 67 个节点。主要使用 If, N8n, Set, Code, Filter 等节点,结合人工智能技术实现智能自动化。 通过 Telegram 机器人命令远程控制 n8n 实例

前置要求
  • Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "oPfjCB6LU7nwNRiu",
  "meta": {
    "instanceId": "7e84375f1a5a2398bff60c3e83bb370423dae55c261ed7c48ca02f15548655a7",
    "templateCredsSetupCompleted": true
  },
  "name": "Telegram-n8n-指挥官",
  "tags": [],
  "nodes": [
    {
      "id": "7e8112a5-41a0-4e2e-b2ee-bef7b4a2a2c0",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        40,
        -180
      ],
      "webhookId": "0eea20d1-fab3-416e-8f22-6f975f79650b",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "chatIds": "123456789",
          "userIds": "123456789"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2ea34661-3183-4e5b-876b-7d823b15b6e2",
      "name": "命令解析",
      "type": "n8n-nodes-base.set",
      "position": [
        260,
        -180
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ce8eebdd-c313-4444-a1bd-dcde56619a0d",
              "name": "command",
              "type": "string",
              "value": "={{\n  $json.message.text\n    .toLowerCase()\n    .replace(/^\\//, '')\n    .split(/ (.+)/)[0]\n  || ''\n}}"
            },
            {
              "id": "834f7369-52f1-4df3-bfcb-754be0bb11e0",
              "name": "arg1",
              "type": "string",
              "value": "={{\n  $json.message.text\n    .toLowerCase()\n    .replace(/^\\//, '')\n    .split(/ (.+)/)[1]\n  || ''\n}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ac92629e-1a7c-45ed-88e5-cb399ccb97fd",
      "name": "命令切换",
      "type": "n8n-nodes-base.switch",
      "position": [
        480,
        -320
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "start",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "d5b702ed-dcaf-461a-a148-04b231d55617",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Cmd Parse').item.json.command }}",
                    "rightValue": "start"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "help",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e9ac521f-9416-4756-9f3c-9be5dd5a5ccb",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Cmd Parse').item.json.command }}",
                    "rightValue": "help"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "backup",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e20bdf17-2418-43ad-8b37-a4a5f4e46b2a",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Cmd Parse').item.json.command }}",
                    "rightValue": "backup"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "cleanup",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b1dfbc98-aac0-483c-a386-79180e96d0bb",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Cmd Parse').item.json.command }}",
                    "rightValue": "cleanup"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "workflows",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2524d410-a971-4a1f-b8a1-c30d363c6be6",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Cmd Parse').item.json.command }}",
                    "rightValue": "workflows"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "execute",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a27bd761-d2d6-4768-9449-ca5380db38ce",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Cmd Parse').item.json.command }}",
                    "rightValue": "execute"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "activate",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "593d46f5-40ce-468a-b834-c2376dca1684",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Cmd Parse').item.json.command }}",
                    "rightValue": "activate"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "deactivate",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0ff85afd-02f8-42ad-b892-59b3dcf025a9",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Cmd Parse').item.json.command }}",
                    "rightValue": "deactivate"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "executions",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f5dee847-2c55-427f-a1f9-3f038f19e30e",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Cmd Parse').item.json.command }}",
                    "rightValue": "executions"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "ignoreCase": true,
          "fallbackOutput": "extra",
          "renameFallbackOutput": "Error"
        }
      },
      "executeOnce": false,
      "typeVersion": 3.2
    },
    {
      "id": "3982240a-01cf-4e67-b342-3d93db95823e",
      "name": "执行参数",
      "type": "n8n-nodes-base.if",
      "position": [
        840,
        -160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Cmd Parse').item.json.arg1 }}",
              "rightValue": "="
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "89cd3673-334b-48dd-9a7c-cf75fb057731",
      "name": "激活工作流",
      "type": "n8n-nodes-base.n8n",
      "onError": "continueErrorOutput",
      "position": [
        2440,
        20
      ],
      "parameters": {
        "operation": "activate",
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "dHsxHtoIyVtfGJFZ",
          "name": "n8n account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "21192505-acee-40cf-9919-f45ad47889d1",
      "name": "停用工作流",
      "type": "n8n-nodes-base.n8n",
      "onError": "continueErrorOutput",
      "position": [
        2440,
        200
      ],
      "parameters": {
        "operation": "deactivate",
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "dHsxHtoIyVtfGJFZ",
          "name": "n8n account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c20275b8-d100-4337-8c3e-4a14753a65e0",
      "name": "激活参数",
      "type": "n8n-nodes-base.if",
      "position": [
        840,
        20
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Cmd Parse').item.json.arg1 }}",
              "rightValue": "="
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "0b7ae6dc-20bf-49ef-80cc-811f9c403654",
      "name": "停用参数",
      "type": "n8n-nodes-base.if",
      "position": [
        840,
        200
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Cmd Parse').item.json.arg1 }}",
              "rightValue": "="
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "16672e7a-0c6d-4c16-b908-de68ce41d686",
      "name": "参数错误",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        1140,
        660
      ],
      "webhookId": "d1b9cd05-5507-45aa-8ee8-5c19eccfc76d",
      "parameters": {
        "text": "=❌ This command requires an argument!",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f512c74c-e552-472f-ba4f-aa02a4bed45c",
      "name": "命令错误",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        840,
        660
      ],
      "webhookId": "033ee218-b4e1-420b-bf73-592029ba53a1",
      "parameters": {
        "text": "=❌ Invalid command!",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "409139e8-69b0-48c9-9e79-0d46a3f8b538",
      "name": "已执行",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        -160
      ],
      "webhookId": "93483e2c-71d5-4733-9572-b205551fff74",
      "parameters": {
        "text": "=✅ Workflow executed.",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a3065a7d-3306-46a4-948f-2b055ed7705b",
      "name": "已激活",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        20
      ],
      "webhookId": "a26128ae-81be-4d1a-bf6d-bf38ef54816b",
      "parameters": {
        "text": "=✅ Workflow activated.",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8fb19383-e6de-4f59-a780-11c8092a9240",
      "name": "已停用",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        200
      ],
      "webhookId": "51e51fa0-93b9-4c39-8896-f9d72df898e4",
      "parameters": {
        "text": "=✅ Workflow deactivated.",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4dba4e0e-e012-4cbf-8a44-aadb0e27240a",
      "name": "工作流名称错误",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        1920,
        660
      ],
      "webhookId": "76b885b4-302a-4033-89f5-2e3b5c9f6f8c",
      "parameters": {
        "text": "=❌ Workflow name not found!",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "b9aec466-d089-443c-b282-4c1892eebc32",
      "name": "列出工作流 1",
      "type": "n8n-nodes-base.n8n",
      "position": [
        1140,
        -160
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "dHsxHtoIyVtfGJFZ",
          "name": "n8n account"
        }
      },
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "id": "773f2140-a5c9-4744-9874-92fb3da5c7c8",
      "name": "列出工作流 2",
      "type": "n8n-nodes-base.n8n",
      "position": [
        1140,
        20
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "dHsxHtoIyVtfGJFZ",
          "name": "n8n account"
        }
      },
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "id": "e752a9b4-dda9-4ed9-be63-8c47f376fabe",
      "name": "列出工作流 3",
      "type": "n8n-nodes-base.n8n",
      "position": [
        1140,
        200
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "dHsxHtoIyVtfGJFZ",
          "name": "n8n account"
        }
      },
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "id": "efb0a48f-5ab8-4e2a-afc4-8508f557e3f6",
      "name": "如果未激活",
      "type": "n8n-nodes-base.if",
      "position": [
        1920,
        20
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "43882ae1-cf25-46d2-9702-7035590b517c",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.active }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b4392db6-84e2-46c5-9e0b-0d8aae707e05",
      "name": "如果已激活",
      "type": "n8n-nodes-base.if",
      "position": [
        1920,
        200
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "43882ae1-cf25-46d2-9702-7035590b517c",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.active }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3f700f24-d9fb-4e9d-81b9-51941dbd865f",
      "name": "工作流激活错误",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2220,
        660
      ],
      "webhookId": "0d7e6070-983e-47c1-8713-39359d6a41db",
      "parameters": {
        "text": "=❌ Workflow is already active!",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "a078cf85-7ae3-41ca-8707-ea2732ebc683",
      "name": "工作流未激活错误",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2220,
        840
      ],
      "webhookId": "be3c092d-c053-4d15-9c64-4f8bb38ddf5c",
      "parameters": {
        "text": "=❌ Workflow is already inactive!",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "0d111278-5067-4340-933f-8aca588fd880",
      "name": "列出工作流",
      "type": "n8n-nodes-base.n8n",
      "position": [
        840,
        -340
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "dHsxHtoIyVtfGJFZ",
          "name": "n8n account"
        }
      },
      "executeOnce": true,
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "39d952ee-0a7e-4c3b-b5a1-1e2a27dd8abc",
      "name": "帮助",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        840,
        -900
      ],
      "webhookId": "2f993ec0-a72e-4bf3-a5c0-8d31742d80e1",
      "parameters": {
        "text": "=My commands are:\n\n\n➖ help\nList of commands.\n\n➖ cleanup\nDeletes all archived workflows.\n\n➖ backup\nBackup workflows and credentials.\n\n➖ workflows\nList all workflows.\n\n➖ execute <workflow-name>\nExecute a workflow.\n\n➖ activate <workflow-name>\nActivate a workflow.\n\n➖ deactivate <workflow-name>\nDeactivate a workflow.\n\n➖ executions <workflow-name>\nList last executions.\n\n\n💡 To execute a workflow, it must have a trigger node of type \"When Executed by Another Workflow\". To activate a workflow, it must have a trigger node that supports activation.",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "eb4ef3de-ac0d-4387-9066-3d5297409158",
      "name": "工作流列表",
      "type": "n8n-nodes-base.set",
      "position": [
        1380,
        -340
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "43a779d0-acf5-49d8-920a-590af435b7d1",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "09a74ca9-26fe-490f-b4db-c9c40200e2a5",
              "name": "active",
              "type": "boolean",
              "value": "={{ $json.active }}"
            }
          ]
        }
      },
      "typeVersion": 3.4,
      "alwaysOutputData": true
    },
    {
      "id": "b9153d0c-24fe-44d7-9d6a-ad4f235d304c",
      "name": "工作流",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        -340
      ],
      "webhookId": "5ae7f6bf-d7b9-4f2a-8a99-2b93109779ff",
      "parameters": {
        "text": "={{ $json.msg }}",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "02e0030f-743f-4491-bf86-c5c39e4db4ba",
      "name": "找到工作流 1",
      "type": "n8n-nodes-base.if",
      "position": [
        1620,
        -160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "18dab2ca-c722-4d2f-8d91-f24a12e28d91",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.isEmpty() }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6dd81360-e878-4ee3-b73f-8f078824f536",
      "name": "找到工作流 2",
      "type": "n8n-nodes-base.if",
      "position": [
        1620,
        20
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "18dab2ca-c722-4d2f-8d91-f24a12e28d91",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.isEmpty() }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4c2aad63-9d8a-4f45-8633-92b9742b0029",
      "name": "找到工作流 3",
      "type": "n8n-nodes-base.if",
      "position": [
        1620,
        200
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "18dab2ca-c722-4d2f-8d91-f24a12e28d91",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.isEmpty() }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bdce9b81-d4a0-4be3-9abe-df48b2e8d633",
      "name": "未归档",
      "type": "n8n-nodes-base.filter",
      "position": [
        1140,
        -340
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "075dd1e2-2580-4016-ba11-3b271049a718",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.isArchived }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "2fb0bf45-2f2f-4c3a-a6ef-4077c5f1a0de",
      "name": "查找工作流 1",
      "type": "n8n-nodes-base.filter",
      "position": [
        1380,
        -160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "278fa2d1-3d8a-48b3-b898-0d81779bcb11",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.name.toLowerCase() }}",
              "rightValue": "={{ $('Execute Arg').item.json.arg1 }}"
            },
            {
              "id": "83bc1669-a58f-45c9-a6f3-4d3a94d72fa5",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.isArchived }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "e6532b4b-5791-4469-add8-49a23076d63e",
      "name": "查找工作流 2",
      "type": "n8n-nodes-base.filter",
      "position": [
        1380,
        20
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "278fa2d1-3d8a-48b3-b898-0d81779bcb11",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.name.toLowerCase() }}",
              "rightValue": "={{ $('Activate Arg').item.json.arg1 }}"
            },
            {
              "id": "ca761ff5-d7ac-4c11-b844-c10d34062fc4",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.isArchived }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "17f4b9aa-c855-4a40-9364-3c71db43c48c",
      "name": "查找工作流 3",
      "type": "n8n-nodes-base.filter",
      "position": [
        1380,
        200
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "278fa2d1-3d8a-48b3-b898-0d81779bcb11",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.name.toLowerCase() }}",
              "rightValue": "={{ $('Deactivate Arg').item.json.arg1 }}"
            },
            {
              "id": "6eec9d79-2ad2-40af-8baf-38ab772f6f0b",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.isArchived }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "6b8abadf-6bbf-4332-bd95-c1f2b8b29e62",
      "name": "执行参数",
      "type": "n8n-nodes-base.if",
      "position": [
        840,
        380
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Cmd Parse').item.json.arg1 }}",
              "rightValue": "="
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3ee440a3-db15-4398-b337-246dccda4032",
      "name": "列出工作流 4",
      "type": "n8n-nodes-base.n8n",
      "position": [
        1140,
        380
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "dHsxHtoIyVtfGJFZ",
          "name": "n8n account"
        }
      },
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "id": "8391a4ec-b382-4062-92b5-0e174c606fd5",
      "name": "查找工作流 4",
      "type": "n8n-nodes-base.filter",
      "position": [
        1380,
        380
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "278fa2d1-3d8a-48b3-b898-0d81779bcb11",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.name.toLowerCase() }}",
              "rightValue": "={{ $('Executions Arg').item.json.arg1 }}"
            },
            {
              "id": "6eec9d79-2ad2-40af-8baf-38ab772f6f0b",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.isArchived }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "e6f15777-a0d8-4f2b-a086-f97887b1844a",
      "name": "找到工作流 4",
      "type": "n8n-nodes-base.if",
      "position": [
        1620,
        380
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "18dab2ca-c722-4d2f-8d91-f24a12e28d91",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.isEmpty() }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1527438a-4600-4255-9034-0e5af7bd5581",
      "name": "列出工作流执行记录",
      "type": "n8n-nodes-base.n8n",
      "position": [
        1920,
        380
      ],
      "parameters": {
        "limit": 50,
        "filters": {
          "workflowId": {
            "__rl": true,
            "mode": "id",
            "value": "={{ $json.id }}"
          }
        },
        "options": {},
        "resource": "execution",
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "dHsxHtoIyVtfGJFZ",
          "name": "n8n account"
        }
      },
      "executeOnce": true,
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "d9d7c222-ea4c-412a-98da-cd35f86f10f2",
      "name": "执行字段",
      "type": "n8n-nodes-base.set",
      "position": [
        2220,
        380
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0ec10b59-a57e-4b6d-a13a-9d2674fb39b3",
              "name": "id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "18038ae8-3a18-4c6b-b97a-1f222bbe2547",
              "name": "mode",
              "type": "string",
              "value": "={{ $json.mode }}"
            },
            {
              "id": "90484316-e73a-41ff-9cb0-dbdfeaf6da11",
              "name": "started",
              "type": "string",
              "value": "={{ $json.startedAt?.toDateTime().toLocal().format(\"dd/MM/yyyy HH:mm\") }}"
            },
            {
              "id": "a56880cb-3c81-48fc-bd96-ec018e43ec5e",
              "name": "workflow",
              "type": "string",
              "value": "={{ $('Workflow Found 4').item.json.name }}"
            },
            {
              "id": "d89a11d0-2abd-4fad-ba64-510e9d922158",
              "name": "finished",
              "type": "boolean",
              "value": "={{ $json.finished }}"
            }
          ]
        }
      },
      "typeVersion": 3.4,
      "alwaysOutputData": true
    },
    {
      "id": "589ffd48-f9d6-464d-93ff-a0bed5ccf528",
      "name": "执行记录",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        380
      ],
      "webhookId": "43b75945-8442-4e0a-b848-afae7a4d0d35",
      "parameters": {
        "text": "={{ $json.msg }}",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "00bf4b6a-ec2f-4adb-a14c-38bafe69d7f2",
      "name": "执行消息",
      "type": "n8n-nodes-base.code",
      "position": [
        2440,
        380
      ],
      "parameters": {
        "jsCode": "let msg = \"Executions:\\n\\n\"\nif ($input.first().json.id === null) {\n  return {\n    json: {\n      msg: \"No executions.\"\n    }\n  }\n}\nfor (const item of $input.all()) {\n  let status = item.json.finished ? '✅' : '❌'\n  let mode = item.json.mode === 'manual' ? ' (manual)' : ''\n  msg = msg + (status + \" \" + item.json.workflow + \" - \" + item.json.id + \" - \" + item.json.started + mode + \"\\n\")\n}\nreturn {\n  json: {\n    msg: msg\n  }\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "ec1c2591-4733-4057-9b0c-066b48514df8",
      "name": "工作流消息",
      "type": "n8n-nodes-base.code",
      "position": [
        2440,
        -340
      ],
      "parameters": {
        "jsCode": "let msg = \"Workflows:\\n\\n\"\nif ($input.first().json.name === null) {\n  return {\n    json: {\n      msg: \"No workflows.\"\n    }\n  }\n}\nfor (const item of $input.all()) {\n  let status = item.json.active ? '🟢' : '⚫'\n  msg = msg + (status + \"  \" + item.json.name + \"\\n\")\n}\nreturn {\n  json: {\n    msg: msg\n  }\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "003b5a55-64e4-4cf6-9f8a-8cf94a8e515b",
      "name": "执行工作流",
      "type": "n8n-nodes-base.executeWorkflow",
      "onError": "continueErrorOutput",
      "position": [
        2440,
        -160
      ],
      "parameters": {
        "options": {},
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}",
          "cachedResultName": "={{ $json.id }}"
        },
        "workflowInputs": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9687696c-62ec-4df1-a693-2da19675e6f1",
      "name": "执行错误",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        840
      ],
      "webhookId": "8a5b39fb-80d6-474f-810a-7d3151647e8c",
      "parameters": {
        "text": "=❌ Workflow execution failed!",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6af5662a-61dc-430c-8508-d910b2dc5617",
      "name": "激活错误",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        1020
      ],
      "webhookId": "b38649fe-98bf-4b71-80cd-e800952e95b2",
      "parameters": {
        "text": "=❌ Workflow activation failed!",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "77ab60c5-a1ef-4db7-8432-aece8a15ff17",
      "name": "停用错误",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        1200
      ],
      "webhookId": "516b2616-387f-4059-881c-1f41fe8a54de",
      "parameters": {
        "text": "=❌ Workflow deactivation failed!",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d969f0a8-3589-4087-87b6-9404fec6a231",
      "name": "列出已归档",
      "type": "n8n-nodes-base.n8n",
      "position": [
        840,
        -520
      ],
      "parameters": {
        "filters": {
          "activeWorkflows": false
        },
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "dHsxHtoIyVtfGJFZ",
          "name": "n8n account"
        }
      },
      "executeOnce": true,
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "ef67572a-b733-4c5b-9783-a71638ebc597",
      "name": "仅已归档",
      "type": "n8n-nodes-base.filter",
      "position": [
        1140,
        -520
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "075dd1e2-2580-4016-ba11-3b271049a718",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.isArchived }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "937ee3d9-3604-454b-86f6-ab069bdc3caf",
      "name": "归档消息",
      "type": "n8n-nodes-base.code",
      "position": [
        2440,
        -520
      ],
      "parameters": {
        "jsCode": "let msg = \"Archived Workflows Deleted:\\n\\n\"\nif ($('Archived List').first().json.name === null) {\n  return {\n    json: {\n      msg: \"No archived workflows.\"\n    }\n  }\n}\nfor (const item of $('Archived List').all()) {\n  msg = msg + (\"🗑\" + \"  \" + item.json.name + \"\\n\")\n}\nreturn {\n  json: {\n    msg: msg\n  }\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "d344e304-fb23-4d2f-8bec-def3cab224e9",
      "name": "清理",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        -520
      ],
      "webhookId": "a48ea4b2-39a4-44d5-be6f-97c0029d9f3b",
      "parameters": {
        "text": "={{ $('Archived Message').item.json.msg }}",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f9dfff04-c969-4198-b541-9f7f1d00fd2c",
      "name": "归档列表",
      "type": "n8n-nodes-base.set",
      "position": [
        1380,
        -520
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c0da97ee-d423-48a7-8c79-58c43969a539",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "cba865ac-9909-4a1a-a6ae-58958135920c",
              "name": "id",
              "type": "string",
              "value": "={{ $json.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4,
      "alwaysOutputData": true
    },
    {
      "id": "b21a04cc-93d2-418f-84d3-e1b48c3b3e8d",
      "name": "删除已归档",
      "type": "n8n-nodes-base.n8n",
      "onError": "continueRegularOutput",
      "position": [
        1620,
        -520
      ],
      "parameters": {
        "operation": "delete",
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Archived List').item.json.id }}"
        },
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "dHsxHtoIyVtfGJFZ",
          "name": "n8n account"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "fa38c779-7c83-442b-a5d0-7b69890abab9",
      "name": "备份工作流",
      "type": "n8n-nodes-base.executeCommand",
      "onError": "continueRegularOutput",
      "position": [
        840,
        -700
      ],
      "parameters": {
        "command": "n8n export:workflow --backup --output=/home/node/backup/workflows"
      },
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "0313329a-6d7a-41fa-a34c-7267f20a1e60",
      "name": "备份凭据",
      "type": "n8n-nodes-base.executeCommand",
      "onError": "continueRegularOutput",
      "position": [
        1140,
        -700
      ],
      "parameters": {
        "command": "n8n export:credentials --backup --decrypted --output=/home/node/backup/credentials"
      },
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "153ce344-c050-4ff9-a012-d69e7b80006d",
      "name": "备份压缩包",
      "type": "n8n-nodes-base.executeCommand",
      "onError": "continueRegularOutput",
      "position": [
        1380,
        -700
      ],
      "parameters": {
        "command": "tar -czf /home/node/backup.tar.gz -C /home/node/backup workflows credentials"
      },
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "91b1718a-197e-409d-b564-0618d271bb6b",
      "name": "备份",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        -700
      ],
      "webhookId": "abecda49-24f5-4928-b98a-c4d850d0d2d6",
      "parameters": {
        "chatId": "123456789",
        "operation": "sendDocument",
        "binaryData": true,
        "additionalFields": {
          "fileName": "backup.tar.gz"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "dd089984-95f3-4093-8a42-679534411186",
      "name": "清理文件",
      "type": "n8n-nodes-base.executeCommand",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        -860
      ],
      "parameters": {
        "command": "rm -rf /home/node/backup /home/node/backup.tar.gz"
      },
      "typeVersion": 1
    },
    {
      "id": "62dc0a94-036e-4872-b571-9e850dcb29c7",
      "name": "读取文件",
      "type": "n8n-nodes-base.readWriteFile",
      "onError": "continueErrorOutput",
      "position": [
        2440,
        -700
      ],
      "parameters": {
        "options": {},
        "fileSelector": "/home/node/backup.tar.gz"
      },
      "typeVersion": 1
    },
    {
      "id": "f715531e-cd42-41c3-92c7-4a6d9230f84c",
      "name": "备份错误",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        2740,
        660
      ],
      "webhookId": "4c62b914-7d68-4520-bd82-0d169d1d84fa",
      "parameters": {
        "text": "=❌ Backup failed!",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0d647969-f6e8-4e48-86dd-a359a1797609",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        -1280
      ],
      "parameters": {
        "width": 680,
        "height": 940,
        "content": "# Telegram n8n 指挥官"
      },
      "typeVersion": 1
    },
    {
      "id": "2b6e98a5-1197-4d5c-b589-220bce2ecd3e",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        140
      ],
      "parameters": {
        "width": 680,
        "height": 1260,
        "content": "# 设置"
      },
      "typeVersion": 1
    },
    {
      "id": "6685b9d2-0a0e-4d4c-8312-6efe066fafab",
      "name": "Telegram 节点",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -60,
        1100
      ],
      "webhookId": "5f1283bb-cd9f-4c4d-a062-0b7c939f855e",
      "parameters": {
        "text": ".",
        "chatId": "123456789",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1ec533a1-ce20-4dd8-90fd-b983ca3bc9b8",
      "name": "n8n 节点",
      "type": "n8n-nodes-base.n8n",
      "position": [
        -60,
        840
      ],
      "parameters": {
        "operation": "get",
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "1"
        },
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "dHsxHtoIyVtfGJFZ",
          "name": "n8n account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b871b30b-eb03-4e95-b0ae-49ad574e1262",
      "name": "错误触发器",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        840,
        1020
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1dda43c6-2762-4a52-b012-f1e718e52f2b",
      "name": "如果不是手动执行",
      "type": "n8n-nodes-base.if",
      "position": [
        1060,
        1020
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "732da136-33e9-47fa-9729-65afd9670f4d",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.execution.mode }}",
              "rightValue": "manual"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "de2db9a3-4070-470f-b72d-f0fc74abc43a",
      "name": "n8n 启动触发器",
      "type": "n8n-nodes-base.n8nTrigger",
      "position": [
        840,
        1200
      ],
      "parameters": {
        "events": [
          "init"
        ]
      },
      "typeVersion": 1
    },
    {
      "id": "09f5a744-1292-4b8b-a042-ce9a0818863f",
      "name": "工作流错误消息",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        1320,
        1020
      ],
      "webhookId": "a2fee1cf-d8f5-4c51-aed4-9fa30e0251c5",
      "parameters": {
        "text": "=❌ Execution failed!\n{{ $now.format(\"dd/MM/yyyy HH:mm:ss\") }}\n\n\nWorkflow: \n{{ $json.workflow.name }}\n\nExecution Id:\n{{ $json.execution.id }}\n\nNode: \n{{ $json.execution.lastNodeExecuted }}\n\nError: \n{{ $json.execution.error.message }}",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "28847e14-5313-42cf-9c08-512c34118264",
      "name": "n8n 启动消息",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueRegularOutput",
      "position": [
        1320,
        1200
      ],
      "webhookId": "a2fee1cf-d8f5-4c51-aed4-9fa30e0251c5",
      "parameters": {
        "text": "=❗ Instance started!\n{{ $now.format(\"dd/MM/yyyy HH:mm:ss\") }}",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "9DBsP3DHmG78wJKe",
          "name": "Telegram account n8ncrashbot"
        }
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "oPfjCB6LU7nwNRiu",
    "executionOrder": "v1"
  },
  "versionId": "baf25eeb-efc3-4fdd-9ee0-fa2f3f5928b6",
  "connections": {
    "Cmd Parse": {
      "main": [
        [
          {
            "node": "Cmd Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Active": {
      "main": [
        [
          {
            "node": "Deactivate Workflow",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Workflow Inactive Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read File": {
      "main": [
        [
          {
            "node": "Backup",
            "type": "main",
            "index": 0
          },
          {
            "node": "Cleanup Files",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Backup Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cmd Switch": {
      "main": [
        [
          {
            "node": "Help",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Help",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Backup Workflows",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "List Archived",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "List Workflows ",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Execute Arg",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Activate Arg",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Deactivate Arg",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Executions Arg",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Cmd Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Arg": {
      "main": [
        [
          {
            "node": "List Workflows 1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Arg Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Inactive": {
      "main": [
        [
          {
            "node": "Activate Workflow",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Workflow Active Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Activate Arg": {
      "main": [
        [
          {
            "node": "List Workflows 2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Arg Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Not Archived": {
      "main": [
        [
          {
            "node": "Workflow List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Archived List": {
      "main": [
        [
          {
            "node": "Delete Archived",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Trigger": {
      "main": [
        [
          {
            "node": "If not manual exec",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Archived": {
      "main": [
        [
          {
            "node": "Only Archived",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only Archived": {
      "main": [
        [
          {
            "node": "Archived List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow List": {
      "main": [
        [
          {
            "node": "Workflows Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Backup Tarball": {
      "main": [
        [
          {
            "node": "Read File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deactivate Arg": {
      "main": [
        [
          {
            "node": "List Workflows 3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Arg Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Executions Arg": {
      "main": [
        [
          {
            "node": "List Workflows 4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Arg Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Archived": {
      "main": [
        [
          {
            "node": "Archived Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Workflow 1": {
      "main": [
        [
          {
            "node": "Workflow Found 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Workflow 2": {
      "main": [
        [
          {
            "node": "Workflow Found 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Workflow 3": {
      "main": [
        [
          {
            "node": "Workflow Found 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Workflow 4": {
      "main": [
        [
          {
            "node": "Workflow Found 4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Workflows ": {
      "main": [
        [
          {
            "node": "Not Archived",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Archived Message": {
      "main": [
        [
          {
            "node": "Cleanup",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Backup Workflows": {
      "main": [
        [
          {
            "node": "Backup Credentials",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow": {
      "main": [
        [
          {
            "node": "Executed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Execution Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Workflows 1": {
      "main": [
        [
          {
            "node": "Find Workflow 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Workflows 2": {
      "main": [
        [
          {
            "node": "Find Workflow 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Workflows 3": {
      "main": [
        [
          {
            "node": "Find Workflow 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Workflows 4": {
      "main": [
        [
          {
            "node": "Find Workflow 4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Cmd Parse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Found 1": {
      "main": [
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Workflow Name Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Found 2": {
      "main": [
        [
          {
            "node": "If Inactive",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Workflow Name Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Found 3": {
      "main": [
        [
          {
            "node": "If Active",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Workflow Name Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Found 4": {
      "main": [
        [
          {
            "node": "List Workflow Executions",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Workflow Name Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Activate Workflow": {
      "main": [
        [
          {
            "node": "Activated",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Activation Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Executions Fields": {
      "main": [
        [
          {
            "node": "Executions Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflows Message": {
      "main": [
        [
          {
            "node": "Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Backup Credentials": {
      "main": [
        [
          {
            "node": "Backup Tarball",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Executions Message": {
      "main": [
        [
          {
            "node": "Executions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If not manual exec": {
      "main": [
        [
          {
            "node": "Workflow Error Msg",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deactivate Workflow": {
      "main": [
        [
          {
            "node": "Deactivated",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Deactivation Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "n8n Started Trigger": {
      "main": [
        [
          {
            "node": "n8n Started Msg",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Workflow Executions": {
      "main": [
        [
          {
            "node": "Executions Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 开发运维, 人工智能

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量67
分类2
节点类型14
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Arthur Braghetto

Arthur Braghetto

@arthurmb

Engineer, Coder, Maker, Curious...

外部链接
在 n8n.io 查看

分享此工作流