{
  "id": "K8HZyU1t1T1fkCAC",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Role-Based Access Control (RBAC) for Telegram Automations",
  "tags": [],
  "nodes": [
    {
      "id": "91730a83-2ac3-4c51-ba73-43d978b276e3",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1360,
        -16
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c2aa8d8b-7269-40f7-9338-8473f5e0bcd2",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -512,
        384
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "63d3fb8b-46a2-4104-b5c9-ac11bd1f023b",
      "name": "No Operation, do nothing1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -512,
        176
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "07bb34cc-0f9a-4c1a-a03a-79101e095bbb",
      "name": "No Operation, do nothing2",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -512,
        -448
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "2a0c806f-cde4-437a-a76f-6292ad5e18b0",
      "name": "Switch",
      "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": "Employee database",
      "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": "No Operation, do nothing3",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -512,
        -240
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "fa7d42f4-9e8c-4d77-862d-d76889f798d2",
      "name": "No Operation, do nothing4",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -512,
        -32
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c8322102-7c9a-4e82-8aa8-a59092006c1c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1392,
        -112
      ],
      "parameters": {
        "width": 150,
        "height": 256,
        "content": "## Start Workflow\n"
      },
      "typeVersion": 1
    },
    {
      "id": "679cf5ca-7c6a-43de-99ac-9b65e28301c1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        -112
      ],
      "parameters": {
        "width": 166,
        "height": 256,
        "content": "## Access level verification"
      },
      "typeVersion": 1
    },
    {
      "id": "763e212f-d486-41c9-b0c6-609ce6bf3933",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        -112
      ],
      "parameters": {
        "width": 166,
        "height": 256,
        "content": "## First level of access"
      },
      "typeVersion": 1
    },
    {
      "id": "a075b9f6-ae1c-4632-aa3a-dcccaa68685e",
      "name": "Choose Position",
      "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": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        -352
      ],
      "parameters": {
        "width": 182,
        "height": 256,
        "content": "## Second level of access"
      },
      "typeVersion": 1
    },
    {
      "id": "3ef703f7-0180-4fd0-9cc9-af10ffab6990",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -80
      ],
      "parameters": {
        "color": 6,
        "width": 304,
        "height": 192,
        "content": "## Different Access Branch"
      },
      "typeVersion": 1
    },
    {
      "id": "56d8c7fb-6aa1-4106-a6d3-3d2752cd0a87",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        128
      ],
      "parameters": {
        "color": 6,
        "width": 304,
        "height": 192,
        "content": "## Different Access Branch"
      },
      "typeVersion": 1
    },
    {
      "id": "be85b75c-5006-437e-b90b-4997bd3f13e6",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        336
      ],
      "parameters": {
        "color": 6,
        "width": 304,
        "height": 192,
        "content": "## Different Access Branch"
      },
      "typeVersion": 1
    },
    {
      "id": "c05ec331-b40e-4bbf-a15e-1ddac855149c",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -288
      ],
      "parameters": {
        "color": 6,
        "width": 304,
        "height": 192,
        "content": "## Different Access Branch"
      },
      "typeVersion": 1
    },
    {
      "id": "84cc9d33-0609-4e21-9b01-66b47e0bef0b",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -496
      ],
      "parameters": {
        "color": 6,
        "width": 304,
        "height": 192,
        "content": "## Different Access Branch"
      },
      "typeVersion": 1
    },
    {
      "id": "6a572860-ef0e-4901-bffd-18096516a30a",
      "name": "Slack Trigger",
      "type": "n8n-nodes-base.slackTrigger",
      "position": [
        -1376,
        208
      ],
      "parameters": {
        "options": {},
        "trigger": [
          "any_event"
        ],
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5777c1eb-aa86-4e23-848b-bc91ec133345",
      "name": "Get row(s) in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1184,
        208
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "16445f51-bcfa-4f60-b4d7-27c06c011f30",
      "name": "Get a record",
      "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": "Get a database page",
      "type": "n8n-nodes-base.notion",
      "position": [
        -1184,
        544
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "resource": "databasePage",
        "operation": "get"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8091fb5a-6d7b-4f10-b5fb-7eedf661203b",
      "name": "If",
      "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": "Filter",
      "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": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1376,
        368
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2.3
    },
    {
      "id": "576ce797-e1ba-4d6a-806e-5e11b3662ec4",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1376,
        544
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5beb4bf6-ba3c-496b-a4ae-25b9577898f7",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1392,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 608,
        "height": 576,
        "content": "## Can be used\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9d418c6a-8119-4a65-9721-ef9b3c3072d1",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2064,
        64
      ],
      "parameters": {
        "width": 640,
        "height": 672,
        "content": "## Instruction\n\n**1. Prepare Employee Table**\nCreate a Data Table with columns:\nUserName===Position===Type\n\nUser_1===Marketing===SEO  \nUser_2===Sales===Manager  \nUser_3===Administration===HR\n\n\nSelect this table in the Employee database node (Data Table ID).\n\n**2. Configure Access Logic**\n\nSwitch (Position): {{$json.Position}}\n\u2192 branches: Marketing, Sales, Administration\n\nInside Marketing: Switch (Role) \u2192 {{ $('Employee database').item.json.Type }}\n\u2192 roles: Target, SEO, SMM\n\n**3. Customize Role Actions**\n\nTarget \u2192 performance tracking\n\nSEO \u2192 Telegram confirmation / analytics sync\n\nSMM \u2192 content posting\n\nSales / Administration \u2192 custom workflows\n\n**4. Test the Flow**\nActivate workflow \u2192 send Telegram message \u2192\nsystem checks username \u2192 finds Position & Type \u2192 routes to correct branch."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "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
          }
        ],
        []
      ]
    }
  }
}