Fixing Telegram Triggers in n8n with Coolify & Cloudflare
How I solved HTTPS and DNS issues for Telegram triggers in n8n by running it via Docker in Coolify and exposing it securely through Cloudflare Tunnel. Published at 2025-08-10

When I first tried running n8n on my Raspberry Pi 5 through Coolify, I hit a wall. All I wanted was a money-tracking app that takes input from Telegram through n8n triggers.

The problem: HTTPS and Telegram

Coolify makes it easy to install n8n as a service, but the default deployment gave me an HTTP-only service URL, and Telegram requires HTTPS for webhooks. Setting N8N_PROTOCOL=https and WEBHOOK_URL=https://… didn’t help either, because n8n still generated HTTP webhook URLs internally. What came back was:

Bad Request: bad webhook: An HTTPS URL must be provided

Without control over n8n’s networking or the Traefik config inside Coolify, there was no clean way to fix that.

The solution: run n8n as a custom Docker service

Instead of Coolify’s one-click n8n service, I created a custom service from a Dockerfile. That gave me control over the exposed port (5678), the environment variables, and the external URL configuration.

From there:

  1. Created a service from Docker in Coolify.
  2. Set N8N_HOST, N8N_PROTOCOL=https, WEBHOOK_URL, and N8N_EDITOR_BASE_URL properly.
  3. Used Cloudflare Tunnel to expose the service securely on https://n8n.leskoding.com.

Now the webhook URL n8n handed out was actually HTTPS.

The DNS and Cloudflare twist

Telegram still failed, this time with a different error:

Bad Request: bad webhook: Failed to resolve host

My Cloudflare DNS was fine, a proxied CNAME pointing at the tunnel. What was blocking Telegram’s bot servers was Cloudflare’s security features. I fixed it by deleting the old webhook from Telegram. That’s it, good lord.

Registering the webhook correctly

This part tripped me up. You can’t point the webhook at your domain root. Telegram needs the exact path that n8n generates for your trigger.

First clear the old one:

$ curl -s "https://api.telegram.org/bot<NEW_TOKEN>/deleteWebhook?drop_pending_updates=true"

Then set the full HTTPS path:

$ curl -s -X POST "https://api.telegram.org/bot<NEW_TOKEN>/setWebhook" 
  -d "url=https://n8n.leskoding.com/webhook/<uuid>/webhook"

Once I did that, Telegram triggers fired instantly.

So: skip Coolify’s built-in n8n app if you need Telegram triggers, because its HTTPS handling is too limited. Deploy n8n from a custom Dockerfile instead, put Cloudflare Tunnel in front of it for secure public access, and always give Telegram the full HTTPS path rather than just the domain.

My n8n workflows trigger reliably from Telegram now, and the money-tracking app is alive. Thanks for stopping by folks!