What is the Geographic Firewall on Telegram?

Filter Telegram group joiners by country before captcha loads. When someone taps Verify Captcha, Cloudflare's country header is checked — blocked regions are kicked or banned via /firewall rules you set with @doublegram_captcha_bot.

The geographic firewall in @doublegram_captcha_bot lets admins control who can even attempt captcha in a Telegram group based on the user's country of origin. It runs when the member opens the Mini App — before Google reCAPTCHA is shown.

How country is detected

When a user opens the verification Mini App in Telegram, traffic passes through Cloudflare. The server reads the CF-IPCountry header (ISO country code, e.g. US, IT, DE) and compares it to your group's firewall rules.

If blocked:

  • User is removed immediately (ban or kick per your punishment setting)
  • reCAPTCHA never loads
  • Event is logged for /stats firewall section
  • Group owner may get a notification if enabled in /settings

Configure the firewall

Admins send /firewall in the group — an inline keyboard to:

  • Select countries (paginated, 10 per page)
  • Switch Blacklist vs Whitelist mode
  • Switch Ban vs Kick punishment

Firewall vs captcha vs timeout

LayerWhenPurpose
Geographic firewallOpening Mini AppCountry-based access control
reCAPTCHAAfter geo passHuman vs bot check
Timeout kickerMute without verifyRemove slow or abandoned joins

VPN caveat: Country reflects the IP Cloudflare sees. VPN users may appear as a different country than their real location.

Quick reference

  • Command: /firewall
  • Detection: Cloudflare CF-IPCountry
  • Runs: before reCAPTCHA
  • Modes: blacklist or whitelist

Related: set up blacklist mode to block specific countries — see Firewall Blacklist Mode on Telegram.