AutomationFlowsSlack & Telegram › Verify Telegram Channel Subscriptions with Access Control Using Postgres

Verify Telegram Channel Subscriptions with Access Control Using Postgres

ByAndrew @boanse on n8n.io

This workflow is for Telegram bot developers or marketers who want to verify user subscriptions to specific Telegram channels and optionally reward them with downloadable files.

Event trigger★★★★★ complexity45 nodesTelegramPostgresGoogle DriveTelegram Trigger
Slack & Telegram Trigger: Event Nodes: 45 Complexity: ★★★★★ Added:

This workflow corresponds to n8n.io template #3615 — we link there as the canonical source.

This workflow follows the Google Drive → Telegram recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "At3piGg3jQlWocQ0",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "TG-Bot-Module-Check_Subscription-v4-db-sell-full",
  "tags": [
    {
      "id": "EwFGeL3ePPNgm0R7",
      "name": "telegram",
      "createdAt": "2025-02-10T18:10:47.435Z",
      "updatedAt": "2025-02-10T18:10:47.435Z"
    },
    {
      "id": "XPad0ERjSdqfxG52",
      "name": "module",
      "createdAt": "2025-03-31T08:11:00.151Z",
      "updatedAt": "2025-03-31T08:11:00.151Z"
    },
    {
      "id": "2ocrWSzdKoCOU2AC",
      "name": "sell",
      "createdAt": "2025-04-19T15:39:51.859Z",
      "updatedAt": "2025-04-19T15:39:51.859Z"
    }
  ],
  "nodes": [
    {
      "id": "a7919674-7ee6-48a2-a016-d3e5fb8d11cb",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        140
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e5cfe2c0-221b-46a0-afad-071fb40b1c84",
      "name": "Get Subscription statuses",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2820,
        -1980
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "f49053b9-9ac3-4b0d-9452-6564dd6583b9",
      "name": "Get Channels",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2600,
        -1980
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "4635c188-483f-4622-b0fc-61f9bd2fbd50",
      "name": "Union statuses",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3040,
        -1980
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "63b098c5-d263-44ce-8e97-25f65a336117",
      "name": "Check",
      "type": "n8n-nodes-base.if",
      "position": [
        3260,
        -1980
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 2.2,
      "alwaysOutputData": false
    },
    {
      "id": "01a28e03-3afb-444f-a1ec-4d91f4ae445a",
      "name": "Check failed",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3480,
        -1780
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "3ef42885-7096-4bca-b46b-e6e6098fd204",
      "name": "Get File",
      "type": "n8n-nodes-base.googleDrive",
      "disabled": true,
      "position": [
        3480,
        -2180
      ],
      "parameters": {},
      "executeOnce": false,
      "typeVersion": 3
    },
    {
      "id": "85dac9aa-c453-49f8-888a-9d868715ed43",
      "name": "Download File",
      "type": "n8n-nodes-base.googleDrive",
      "disabled": true,
      "position": [
        3700,
        -2180
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "f62b58f5-2c43-48c6-8421-5db9b1270411",
      "name": "Add Channel",
      "type": "n8n-nodes-base.postgres",
      "onError": "continueErrorOutput",
      "position": [
        1940,
        -780
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "5379c208-1b79-48d2-9c4b-448cf97cf911",
      "name": "Variables TG",
      "type": "n8n-nodes-base.set",
      "position": [
        160,
        -180
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "52d70635-add3-4f08-8754-10be51121fcc",
      "name": "Initialization",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        -180
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "e994a732-e39d-4ccf-a16b-917c04d2857d",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -60,
        -180
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "555e8dbe-19a9-4ff4-9eab-8625f062788c",
      "name": "Get Bot Status",
      "type": "n8n-nodes-base.postgres",
      "position": [
        840,
        -380
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "f6c60730-4534-46d7-ac21-aa2e6c60a25b",
      "name": "Define flow",
      "type": "n8n-nodes-base.switch",
      "position": [
        1060,
        -420
      ],
      "parameters": {},
      "typeVersion": 3.2,
      "alwaysOutputData": false
    },
    {
      "id": "04d84bd6-9684-4e0c-8d27-07bb193b16c0",
      "name": "Commands",
      "type": "n8n-nodes-base.switch",
      "position": [
        1500,
        -1260
      ],
      "parameters": {},
      "retryOnFail": false,
      "typeVersion": 3.2
    },
    {
      "id": "7e061558-50d7-4ecc-be0c-7df9b3afdc70",
      "name": "Channel Exists",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2160,
        -780
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "8c71e3cc-0646-43b0-a5f7-8f3adb900bd3",
      "name": "Update bot status on CHECK SUBSCRIPTION REQUEST CHANNEL",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1940,
        -1380
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "b24e4e29-0142-412a-aee8-daa834915130",
      "name": "Request Add Channel",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1720,
        -1380
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "01859e62-69b7-4ada-a5ff-b6ef7ff72677",
      "name": "Update bot status on CHECK SUBSCRIPTION REQUEST CHANNEL1",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1940,
        -1180
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "fe963f1a-73b8-4afd-a01d-c283d8ff6c91",
      "name": "Request Delete Channel",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1720,
        -1180
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "ce4685ca-63fa-4962-bf6c-037f6c15e4e7",
      "name": "Request New Delete Channel",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2160,
        -580
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "d0aa6264-f929-42ac-a614-00eaf6d651a2",
      "name": "Request New Add Channel",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2160,
        -980
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "8a10c59e-a8f2-42b4-bc3a-1863e8e125ec",
      "name": "Channel Not Exists",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2160,
        -380
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "dfed929b-975d-494b-9aa9-73938b6d857a",
      "name": "Delete Channel",
      "type": "n8n-nodes-base.postgres",
      "onError": "continueErrorOutput",
      "position": [
        1940,
        -580
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "bb12a749-78e1-4714-820a-5720e990ccf6",
      "name": "Get Channels ",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1720,
        -1580
      ],
      "parameters": {},
      "typeVersion": 2.5,
      "alwaysOutputData": true
    },
    {
      "id": "e3d23352-7be0-4d1f-80e3-53ee22d2ce9c",
      "name": "Add Divide Channels",
      "type": "n8n-nodes-base.summarize",
      "position": [
        1940,
        -1580
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "697ea427-4f9e-40ee-b7db-0a331ad7b216",
      "name": "Channels",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2160,
        -1580
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "9e0607a1-72cb-4424-8632-f978e3faf528",
      "name": "Define Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        620,
        -380
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "a03415cd-1f3a-453f-a19c-91d547d43330",
      "name": "Update bot status on START",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1060,
        -780
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "4a9856ca-0ace-4f2c-a7b2-138886f142d5",
      "name": "Buttons",
      "type": "n8n-nodes-base.switch",
      "position": [
        840,
        -780
      ],
      "parameters": {},
      "typeVersion": 3.2,
      "alwaysOutputData": false
    },
    {
      "id": "e98dddbd-5d2f-4ae5-b24c-1ef663cbf244",
      "name": "Success",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1280,
        -780
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "2af1329e-7e60-445a-9567-f25feccef426",
      "name": "Get Channels  ",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1500,
        -380
      ],
      "parameters": {},
      "typeVersion": 2.5,
      "alwaysOutputData": true
    },
    {
      "id": "5e91b148-a095-4238-8d29-5f81337fdaee",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        1720,
        -380
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "b6a8d046-d63f-4a94-b6f7-b50c59228662",
      "name": "Welcome message Referal",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1940,
        -1980
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "03fc7662-d1fa-49b0-8574-a727f7aea2fd",
      "name": "Welcome message Manager",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1940,
        -1780
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "9de886ca-0e1b-4bcc-94e4-48bacb84b1f7",
      "name": "Upsert bot status on START",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2160,
        -1780
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "ea3fbe94-f0db-42bf-8418-988252e8137d",
      "name": "Referal?",
      "type": "n8n-nodes-base.if",
      "position": [
        1720,
        -1780
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "f872e8ee-a4d3-48ff-a8ad-a8c2693de284",
      "name": "Update bot status and referal",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2160,
        -1980
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "34f90c75-eb5e-4aa8-b8c2-b31234805738",
      "name": "Get Referal",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2380,
        -1980
      ],
      "parameters": {},
      "typeVersion": 2.5,
      "alwaysOutputData": true
    },
    {
      "id": "8b5373a2-7bb6-4d5f-876b-73f255cf5da7",
      "name": "Check success",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3480,
        -1980
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "d1dbf21a-9ad4-4ef6-93d5-f0afecefc081",
      "name": "Check success + File",
      "type": "n8n-nodes-base.telegram",
      "disabled": true,
      "position": [
        3920,
        -2180
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "57798b03-2661-4842-a547-b9d42b10b98c",
      "name": "Is Admin?",
      "type": "n8n-nodes-base.if",
      "position": [
        620,
        -180
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "a0878b73-7fa6-4cac-8410-ea6bdacc9964",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        -500
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "bbb66815-c58a-40a1-b425-669f94a20c34",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        -180
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "203853e7-5df1-4305-82d8-9a1a2416ff38",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        140
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2142c115-ceca-4a1c-811f-12cca4b35069",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Delete Channel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Channel Not Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check": {
      "main": [
        [
          {
            "node": "Get File",
            "type": "main",
            "index": 0
          },
          {
            "node": "Check success",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Buttons": {
      "main": [
        [
          {
            "node": "Update bot status on START",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Channels": {
      "main": [
        []
      ]
    },
    "Commands": {
      "main": [
        [],
        [
          {
            "node": "Referal?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Channels ",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Request Add Channel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Request Delete Channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get File": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Referal?": {
      "main": [
        [
          {
            "node": "Welcome message Referal",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Welcome message Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Admin?": {
      "main": [
        [
          {
            "node": "Define Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Channel": {
      "main": [
        [
          {
            "node": "Request New Add Channel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Channel Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define Type": {
      "main": [
        [
          {
            "node": "Buttons",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Bot Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define flow": {
      "main": [
        [
          {
            "node": "Commands",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Add Channel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Channels  ",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Get Referal": {
      "main": [
        [
          {
            "node": "Get Channels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Channels": {
      "main": [
        [
          {
            "node": "Get Subscription statuses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Variables TG": {
      "main": [
        [
          {
            "node": "Initialization",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Check success + File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Channels ": {
      "main": [
        [
          {
            "node": "Add Divide Channels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Channel": {
      "main": [
        [
          {
            "node": "Request New Delete Channel",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Get Bot Status": {
      "main": [
        [
          {
            "node": "Define flow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Channels  ": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initialization": {
      "main": [
        [
          {
            "node": "Is Admin?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Union statuses": {
      "main": [
        [
          {
            "node": "Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Variables TG",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Divide Channels": {
      "main": [
        [
          {
            "node": "Channels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request Add Channel": {
      "main": [
        [
          {
            "node": "Update bot status on CHECK SUBSCRIPTION REQUEST CHANNEL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check success + File": {
      "main": [
        []
      ]
    },
    "Request Delete Channel": {
      "main": [
        [
          {
            "node": "Update bot status on CHECK SUBSCRIPTION REQUEST CHANNEL1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Welcome message Manager": {
      "main": [
        [
          {
            "node": "Upsert bot status on START",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Welcome message Referal": {
      "main": [
        [
          {
            "node": "Update bot status and referal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Subscription statuses": {
      "main": [
        [
          {
            "node": "Union statuses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update bot status on START": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update bot status and referal": {
      "main": [
        [
          {
            "node": "Get Referal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow is for Telegram bot developers or marketers who want to verify user subscriptions to specific Telegram channels and optionally reward them with downloadable files.

Source: https://n8n.io/workflows/3615/ — original creator credit. Request a take-down →

More Slack & Telegram workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Slack & Telegram

This template is ideal for users managing Telegram channels who want to automate the process of posting messages, including text and images, directly from an bot.

Telegram Trigger, Postgres, Telegram
Slack & Telegram

This template is for developers and automation specialists looking to create a Telegram bot that enables users to select items from a predefined list and save their choices to a Postgres database.

Telegram, Postgres, Telegram Trigger
Slack & Telegram

This workflow is ideal for businesses or individuals who want to run Telegram-based giveaways that require users to subscribe to certain channels in order to participate.

Telegram, Postgres, Telegram Trigger
Slack & Telegram

Template was created in n8n v1.90.2 Chat Trigger node Telegram Trigger node Redis node Postgres node Execute Sub-workflow If node, Code node, Edit Fields (Set), Extract From File Community nodes: n8n-

Telegram Trigger, Chat Trigger, Telegram +3
Slack & Telegram

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Telegram Trigger, n8n, Telegram +4