n8nflow.net logo

Protect Telegram Groups with Math CAPTCHA Verification and Google Sheets

by Vadym Nahornyiโ€ขUpdated: Last update a month agoโ€ขSource: n8n.io

Getting Started

Why this template rocks

๐Ÿš€ Lightning-fast setup - Deploy in under 5 minutes
๐Ÿ’ก Zero AI costs - Uses simple math instead of expensive LLM calls
๐Ÿ›ก๏ธ 99% spam blocking - Mathematical CAPTCHAs stop bots instantly
โšก Ultra-efficient - Runs on minimal resources, scales to thousands of users
๐ŸŽฏ Plug-and-play - Just add your bot token and Google Sheet ID

Who's it for

Smart community managers who want maximum protection with minimum complexity. Perfect for:

  • ๐ŸŽฎ Gaming communities (Discord alternatives)
  • ๐Ÿ’ผ Professional Telegram groups
  • ๐Ÿ“š Educational channels with 100+ members
  • ๐ŸŒ Any public group facing spam bot invasions
  • ๐Ÿ’ฐ Communities wanting to save on AI API costs

What it does

This isn't another complicated AI bot - it's a lean, mean spam-fighting machine that works smarter, not harder.

๐Ÿง  Simple brilliance : Instead of expensive AI that can be fooled, we use basic math (1+1=?) that bots consistently fail
๐ŸŽฏ Instant results : New member joins โ†’ Gets math question โ†’ Answers correctly = Welcome! / Wrong answer = Banned
๐Ÿงน Auto-cleanup : All verification messages disappear automatically - your chat stays pristine
๐Ÿ“Š Smart tracking : Google Sheets integration tracks everything without bloating your database

The genius is in the simplicity - real humans solve "7+3=?" in 2 seconds, bots struggle or ignore it completely.

How it works (the magic behind the simplicity)

Step 1 : ๐Ÿ‘๏ธ Bot detects new member instantly
Step 2 : ๐ŸŽฒ Generates random math question (like "4 + 7 = ?")
Step 3 : โ“ Sends personalized challenge mentioning the user
Step 4 : ๐Ÿ“ Stores answer in Google Sheets for verification
Step 5 : โœ… User responds โ†’ Bot checks answer โ†’ Success = Welcome / Fail = Ban
Step 6 : ๐Ÿงน All verification messages auto-delete for clean chat

Why this crushes AI-based solutions:

  • โšก Speed : Math verification takes milliseconds vs AI API calls
  • ๐Ÿ’ฐ Cost : Zero ongoing fees vs expensive LLM tokens
  • ๐ŸŽฏ Accuracy : 99%+ spam detection vs AI false positives
  • ๐Ÿ›ก๏ธ Reliability : Simple logic never breaks vs AI model changes

Requirements (minimal setup, maximum power)

  • ๐Ÿค– Telegram Bot Token (free from @BotFather - takes 30 seconds)
  • ๐Ÿ“Š Google Sheets API (free tier covers 1000s of verifications)
  • ๐Ÿ‘‘ Group Admin Rights (add bot as admin with ban/delete permissions)
  • ๐Ÿ”ง N8N Instance (self-hosted or cloud - works on any plan)

Total setup time: 5 minutes max โฑ๏ธ

How to set up

  1. Configure Bot Credentials :

    • Replace YOUR_TELEGRAM_BOT_TOKEN_HERE in the "โš™๏ธ Bot Configuration" node with your actual bot token from @BotFather
    • Ensure your bot has necessary permissions (delete messages, ban users, read messages)
  2. Set up Google Sheets Integration :

    • Create a new Google Sheet with three columns: id, answer, msg_id
    • Replace YOUR_GOOGLE_SHEET_ID_HERE with your Google Sheet ID
    • Configure Google Sheets credentials in N8N with proper service account access
    • Ensure the sheet is accessible by your service account
  3. Configure Telegram Group :

    • Add your bot to the target Telegram group
    • Promote the bot to administrator with permissions to ban users and delete messages
    • Test bot permissions by manually invoking admin functions
  4. Customize Welcome Message :

    • Edit the welcome message template in the "โš™๏ธ Bot Configuration" node to match your community's tone and style
    • Include any group rules, links, or specific information new members should know
  5. Activate and Test :

    • Enable the workflow in N8N
    • Test the complete flow by joining the group with a test account
    • Verify CAPTCHA delivery, answer verification, and both success/failure paths work correctly

๐Ÿ’ก Pro tip : The simple math foundation makes ANY customization easy - no AI complexity to break!

Why you'll love this template

โšก Instant impact : Deploy once, protect forever
๐Ÿ’ฐ Zero ongoing costs : No AI bills, just pure efficiency
๐Ÿ›ก๏ธ Battle-tested : Stops 99% of spam bots in real communities
๐Ÿ”ง Maintenance-free : Set it and forget it reliability
๐Ÿ“ˆ Scales infinitely : From 10 to 10,000 members witho