n8n self-hosted + Cloudflare Tunnel + Telegram
If you’re self-hosting n8n on your home network and accessing it through a Cloudflare Tunnel, you might run into an issue where Telegram or webhook triggers stop working. This typically occurs when you create a Zero Trust application for the tunnel’s subdomain and attach a login access policy to it. While that policy is great for restricting access to your n8n instance, it also blocks external services—like Telegram—from reaching your webhook endpoints and triggering workflows.
To resolve this, you’ll need to allow Telegram traffic into the application based on its IP ranges. This bypasses the login screen for Telegram requests, so be sure you’re comfortable with that tradeoff. Here’s how to do it:
Step 1 - Add a new policy for Telegram#
- Refer to the Telegram documentation on webhooks to find the IP ranges used by Telegram bots. https://core.telegram.org/bots/webhooks#the-short-version
- Log into your Cloudflare account.
- Click on Zero Trust in the side menu.
- Click on Policies in the side menu under Access.
- Click the “Add a policy” button.
- Enter a name for your policy. I used “Telegram” to make it easier to find later.
- Select the “Service Auth” action. This is different from “Allow” because it allows access without using the login page.
- Under “Add rules” select “IP ranges”.
- Enter the IP ranges from the Telegram documentation. Cut and paste each one for accuracy.
- Click the “Save” button.
Step 2 - Add the policy to your application#
- Click on Applications under the Access section of the side menu.
- Click on your application.
- Click on the Configure button on the right side of the page.
- Click on the Policies tab at the top.
- Click the “Select existing policies” button.
- Select the Telegram policy you created.
- Click the “Save application” button.
Telegram should now be able to hit your self-hosted n8n instance!