8
n8n 中文网amn8n.com

基于角色的访问控制(RBAC)用于Telegram自动化

高级

这是一个Miscellaneous领域的自动化工作流,包含 28 个节点。主要使用 If, Filter, Notion, Switch, Airtable 等节点。 Telegram自动化的基于角色访问控制(RBAC)

前置要求
  • Notion API Key
  • Airtable API Key
  • Google Sheets API 凭证
  • Slack Bot Token 或 Webhook URL
  • Telegram Bot Token

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "K8HZyU1t1T1fkCAC",
  "meta": {
    "instanceId": "abeb4de6795125f40ad5de96d2a952a3dd8b9999a00fda0c983edb96a5a49cc6",
    "templateCredsSetupCompleted": true
  },
  "name": "基于角色的访问控制 (RBAC) 用于 Telegram 自动化",
  "tags": [],
  "nodes": [
    {
      "id": "91730a83-2ac3-4c51-ba73-43d978b276e3",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1360,
        -16
      ],
      "webhookId": "040cc27b-6ede-473a-8d8e-a66812d0846c",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "RcLLE0azz4u7WqdZ",
          "name": "Test Automatization"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c2aa8d8b-7269-40f7-9338-8473f5e0bcd2",
      "name": "无操作,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -512,
        384
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "63d3fb8b-46a2-4104-b5c9-ac11bd1f023b",
      "name": "无操作,不执行任何操作1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -512,
        176
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "07bb34cc-0f9a-4c1a-a03a-79101e095bbb",
      "name": "无操作,不执行任何操作2",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -512,
        -448
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "2a0c806f-cde4-437a-a76f-6292ad5e18b0",
      "name": "分支",
      "type": "n8n-nodes-base.switch",
      "position": [
        -816,
        -256
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Target",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "850d249d-f7a8-452d-a8de-93e3648ecc9b",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Employee database').item.json.Type }}",
                    "rightValue": "Target"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "SEO",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "5dd20b74-52a0-46df-b6df-d96d4c68155d",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Employee database').item.json.Type }}",
                    "rightValue": "SEO"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "SMM",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "1e939c02-b3f9-4843-bfa4-f09c61a2aafe",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Employee database').item.json.Type }}",
                    "rightValue": "SMM"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "676d9554-8a4f-4b18-b332-6712b9cc14b7",
      "name": "员工数据库",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -1184,
        -16
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "UserName",
              "keyValue": "={{ $json.message.from.username }}"
            }
          ]
        },
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "59g2BfS1TctO7gzg"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "cec1cd5f-ca58-4d8c-a514-64912b9ac063",
      "name": "无操作,不执行任何操作3",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -512,
        -240
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "fa7d42f4-9e8c-4d77-862d-d76889f798d2",
      "name": "无操作,不执行任何操作4",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -512,
        -32
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c8322102-7c9a-4e82-8aa8-a59092006c1c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1392,
        -112
      ],
      "parameters": {
        "width": 150,
        "height": 256,
        "content": "## 启动工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "679cf5ca-7c6a-43de-99ac-9b65e28301c1",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        -112
      ],
      "parameters": {
        "width": 166,
        "height": 256,
        "content": "## 访问级别验证"
      },
      "typeVersion": 1
    },
    {
      "id": "763e212f-d486-41c9-b0c6-609ce6bf3933",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        -112
      ],
      "parameters": {
        "width": 166,
        "height": 256,
        "content": "## 第一级访问权限"
      },
      "typeVersion": 1
    },
    {
      "id": "a075b9f6-ae1c-4632-aa3a-dcccaa68685e",
      "name": "选择职位",
      "type": "n8n-nodes-base.switch",
      "position": [
        -992,
        -32
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Marketing",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "68e30c13-0f99-49a5-a125-3e757207620b",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.Position }}",
                    "rightValue": "Marketing"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Sales",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8d58172d-69e6-43e5-9cba-b9a86cb69716",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.Position }}",
                    "rightValue": "Sales"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Administration",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8ad7c78a-e005-459e-996a-8df04eec1507",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.Position }}",
                    "rightValue": "Administration"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "bf25de0f-4a2f-43f4-8689-96aca37bc82c",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        -352
      ],
      "parameters": {
        "width": 182,
        "height": 256,
        "content": "## 第二级访问权限"
      },
      "typeVersion": 1
    },
    {
      "id": "3ef703f7-0180-4fd0-9cc9-af10ffab6990",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -80
      ],
      "parameters": {
        "color": 6,
        "width": 304,
        "height": 192,
        "content": "## 不同访问分支"
      },
      "typeVersion": 1
    },
    {
      "id": "56d8c7fb-6aa1-4106-a6d3-3d2752cd0a87",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        128
      ],
      "parameters": {
        "color": 6,
        "width": 304,
        "height": 192,
        "content": "## 不同访问分支"
      },
      "typeVersion": 1
    },
    {
      "id": "be85b75c-5006-437e-b90b-4997bd3f13e6",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        336
      ],
      "parameters": {
        "color": 6,
        "width": 304,
        "height": 192,
        "content": "## 不同访问分支"
      },
      "typeVersion": 1
    },
    {
      "id": "c05ec331-b40e-4bbf-a15e-1ddac855149c",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -288
      ],
      "parameters": {
        "color": 6,
        "width": 304,
        "height": 192,
        "content": "## 不同访问分支"
      },
      "typeVersion": 1
    },
    {
      "id": "84cc9d33-0609-4e21-9b01-66b47e0bef0b",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -496
      ],
      "parameters": {
        "color": 6,
        "width": 304,
        "height": 192,
        "content": "## 不同访问分支"
      },
      "typeVersion": 1
    },
    {
      "id": "6a572860-ef0e-4901-bffd-18096516a30a",
      "name": "Slack触发器",
      "type": "n8n-nodes-base.slackTrigger",
      "position": [
        -1376,
        208
      ],
      "webhookId": "3ada6a40-b42d-4175-a4ff-f208a8cae962",
      "parameters": {
        "options": {},
        "trigger": [
          "any_event"
        ],
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5777c1eb-aa86-4e23-848b-bc91ec133345",
      "name": "获取表格中的行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1184,
        208
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "PO5jjOqRb3T4m5PE",
          "name": "Google Sheets EGM"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "16445f51-bcfa-4f60-b4d7-27c06c011f30",
      "name": "获取记录",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -1184,
        368
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "options": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "9ebab38a-64ae-4cf9-a67b-f7393e4e435d",
      "name": "获取数据库页面",
      "type": "n8n-nodes-base.notion",
      "position": [
        -1184,
        544
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "resource": "databasePage",
        "operation": "get"
      },
      "credentials": {
        "notionApi": {
          "id": "EddmMwhQbDV4V3oj",
          "name": "Notion Archive"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8091fb5a-6d7b-4f10-b5fb-7eedf661203b",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        -992,
        304
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "34636f26-6207-4687-9e42-2bac831c57a8",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4c76aac7-13ce-4801-a3ca-13f55d5c7cf3",
      "name": "过滤器",
      "type": "n8n-nodes-base.filter",
      "position": [
        -992,
        480
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b52c63b1-9c33-4a06-8c12-7b1f5e39dd35",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c29efe51-94d3-4b7b-bca8-f51b206bd23c",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1376,
        368
      ],
      "webhookId": "386ef677-50f3-4623-9ce8-6e55083cf6de",
      "parameters": {
        "options": {}
      },
      "typeVersion": 2.3
    },
    {
      "id": "576ce797-e1ba-4d6a-806e-5e11b3662ec4",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1376,
        544
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5beb4bf6-ba3c-496b-a4ae-25b9577898f7",
      "name": "便签 9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1392,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 608,
        "height": 576,
        "content": "## 可使用"
      },
      "typeVersion": 1
    },
    {
      "id": "9d418c6a-8119-4a65-9721-ef9b3c3072d1",
      "name": "便签12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2064,
        64
      ],
      "parameters": {
        "width": 640,
        "height": 672,
        "content": "## 使用说明"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {
    "Telegram Trigger": [
      {
        "json": {
          "message": {
            "chat": {
              "id": 1111,
              "type": "private",
              "username": "User 2.2",
              "first_name": "User"
            },
            "from": {
              "id": 1111,
              "is_bot": false,
              "username": "User 2.2",
              "first_name": "User",
              "language_code": "uk"
            },
            "message_id": 612
          },
          "update_id": 414678617
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "064040b8-1026-4fb0-af4b-7613ccc4d632",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "No Operation, do nothing2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Choose Position": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Employee database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Employee database": {
      "main": [
        [
          {
            "node": "Choose Position",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 杂项

需要付费吗?

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

工作流信息
难度等级
高级
节点数量28
分类1
节点类型13
难度说明

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

作者
Yehor EGMS

Yehor EGMS

@egm-systems

Business Automation & E-commerce Expert | Founder & Entrepreneur | N8n.io & Make.com Specialist | Automate ​>80% of routine tasks — helping businesses reduce costs and accelerate processes

外部链接
在 n8n.io 查看

分享此工作流