Skip to main content

Verify Telegram channel subscriptions with access control using Postgres

Workflow preview

Workflow preview
100%
Verify Telegram channel subscriptions with access control using Postgres preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Who is this for? 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. Wh...

Best for

  • Social Media automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.telegram, n8n-nodes-base.postgres, n8n-nodes-base.aggregate, n8n-nodes-base.if, n8n-nodes-base.googledrive, n8n-nodes-base.set, n8n-nodes-base.telegramtrigger

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Andrew.

Original n8n.io source

1.1 Workflow description

Title
Verify Telegram channel subscriptions with access control using Postgres
Workflow name
Verify Telegram channel subscriptions with access control using Postgres

Who is this for?

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.

What problem is this workflow solving?

This workflow ensures users have subscribed to required Telegram channels before they are granted access to resources or rewards, such as Google Drive files. It automates the subscription verification process, saving time and reducing manual effort.

What this workflow does

  • Verifies if a user is subscribed to specific Telegram channels.
  • Allows adding and removing channel IDs for verification.
  • Sends referral links to users for subscription checks.
  • Optionally grants access to Google Drive files upon successful verification (currently inactive)

Setup

  1. Add the bot to your Telegram channels as an admin – this is required for the bot to check subscription status.
  2. Add channel IDs via the bot – these are the channels users will need to subscribe to.
  3. Send the referral link to users you want to verify.
  4. Remove channels anytime from the subscription check list if needed.
  5. Create tables in Postgres:
    • Replace "n8n" in the provided SQL script with your DB schema name.
    • Run the script in your Postgres DB.
  6. Add credentials:
    • Telegram
    • Postgres

How to customize this workflow to your needs

  • Modify the SQL script to suit your existing database structure.
  • Adjust the logic to enable or disable file delivery from Google Drive.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Get Subscription statuses

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 3 - Get Channels

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.5

Block 4 - Union statuses

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 5 - Check

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 6 - Check failed

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 7 - Get File

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 8 - Download File

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 9 - Add Channel

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.5

Block 10 - Variables TG

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 11 - Initialization

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - Telegram Trigger

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1.1

Block 13 - Get Bot Status

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.5

Block 14 - Define flow

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 15 - Commands

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 16 - Channel Exists

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 17 - Update bot status on CHECK SUBSCRIPTION REQUEST CHANNEL

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.5

Block 18 - Request Add Channel

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 19 - Update bot status on CHECK SUBSCRIPTION REQUEST CHANNEL1

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.5

Block 20 - Request Delete Channel

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 21 - Request New Delete Channel

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 22 - Request New Add Channel

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 23 - Channel Not Exists

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 24 - Delete Channel

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.5

Showing the first 24 of 45 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Verify Telegram channel subscriptions with access control using Postgres
Complexity advanced
Nodes 45
Categories Social Media
Author Andrew
Published 19 Apr 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3615/3615.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Verify Telegram channel subscriptions with access control using Postgres do?

Who is this for? 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. Wh...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Social Media use case.