A8gent
All articles

Technical

Bad Request: bad webhook: An HTTPS URL must be provided for webhook - 4 Causes and the Fix in n8n

Telegram refused the webhook URL your n8n Telegram Trigger tried to register because it is not HTTPS. n8n builds that URL from its own settings, so the fix is a public HTTPS address and the webhook URL variable pointing at it.

A8gentAutomation practiceNovember 17, 20269 min read

Short answer: Telegram only registers webhooks on HTTPS URLs, and your n8n instance offered it an http or localhost address. Usually n8n is local or behind a reverse proxy and was never told its public HTTPS URL. Set N8N_WEBHOOK_URL (n8n 2.30.0 and later) or WEBHOOK_URL (earlier) to the public https:// address, restart n8n, then test or publish the workflow again so the Telegram Trigger re-registers.

Contents
  1. The Short Answer
  2. The 4 Causes at a Glance
  3. Cause 1: n8n Runs Locally With No Public HTTPS Address
  4. Cause 2: Behind a Reverse Proxy, n8n Does Not Know Its Public URL
  5. Cause 3: The Variable Is Set, but to the Wrong Value
  6. Cause 4: You Rely on n8n's Built-In --tunnel
  7. Check What Telegram Actually Registered
  8. Still Broken? Check These in Order
  9. How to Stop It Coming Back
  10. Sources
  11. FAQ

The Short Answer

The Telegram Trigger node fails when you listen for a test event or publish the workflow, with:

Telegram Trigger: Bad Request: bad webhook: An HTTPS URL must be provided for webhook

The text after "Bad Request:" comes from Telegram, not n8n. The Telegram Trigger receives messages by webhook: n8n calls Telegram's setWebhook method and hands over its own webhook URL. The Telegram Bot API requires that URL to be HTTPS, so anything starting with http:// is refused.

The n8n Telegram Trigger common issues page gives the fix in two lines: Telegram requires HTTPS, so terminate TLS at your reverse proxy and set the webhook URL variable to your public HTTPS address. What it leaves out is how to do that on a laptop, in Docker, and how to check what Telegram actually received. That is what this page covers.

n8n Cloud already has a public HTTPS URL. This is a self-hosted problem.

The 4 Causes at a Glance

SymptomCauseFixHow to confirm
Fails on a laptop or local DockerNo public HTTPS address existsRun a tunnel, set the webhook URL variable to itThe Telegram Trigger's webhook URL starts with http://localhost:5678
Fails on a server with a working HTTPS domainReverse proxy terminates TLS but n8n was not told its public URLSet N8N_WEBHOOK_URL or WEBHOOK_URL and N8N_PROXY_HOPS, restartThe editor opens on https:// but the node's webhook URL shows http:// or port 5678
Variable is set and it still failsThe value is wrong, or the container was not recreatedUse https://, no :5678, recreate the containerPrint the variable inside the running container
Started with n8n start --tunnelThe built-in tunnel was removed in n8n 2 and discontinued for v1Use ngrok or Cloudflare TunnelYour start command contains --tunnel

Cause 1: n8n Runs Locally With No Public HTTPS Address

This is the main forum thread (almost 20,000 views): n8n in Docker Desktop on Windows, port 5678, and the error. The n8n team's reply: Telegram requires your n8n server to be publicly reachable over HTTPS, and a local Docker instance does not meet that. Telegram's servers cannot reach localhost on your machine, with or without HTTPS.

How to confirm it: open the Telegram Trigger node and look at its webhook URL. If it starts with http://localhost:5678/, n8n is offering Telegram an address it cannot use.

The fix: put a tunnel in front of n8n, then tell n8n the tunnel's address. With ngrok:

ngrok http 5678

Or a Cloudflare quick tunnel:

cloudflared tunnel --url http://localhost:5678

Each prints a public https:// address. The thread asks how to pass it to the standard docker run command and never gets an answer. Add the variables with -e:

docker run -it --rm --name n8n -p 5678:5678 \
  -e N8N_WEBHOOK_URL=https://your-subdomain.ngrok-free.app/ \
  -e N8N_PROXY_HOPS=1 \
  -v n8n_data:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n

On n8n older than 2.30.0, use WEBHOOK_URL instead of N8N_WEBHOOK_URL (see the version note in Cause 2). Then open the workflow and listen for a test event, or publish it, so the trigger registers the new URL with Telegram.

Free tunnel addresses usually change each time the tunnel restarts. When it changes, update the variable, restart n8n and re-register. Our Telegram AI agent tutorial says the same. For anything that must stay up, use a real domain.

Cause 2: Behind a Reverse Proxy, n8n Does Not Know Its Public URL

You have a domain, a certificate and a proxy (Nginx, Caddy, Traefik), and the editor loads fine over HTTPS. The trigger still fails. This is the case the n8n docs describe.

The reason, from the reverse proxy docs: n8n builds webhook URLs from N8N_PROTOCOL, N8N_HOST and N8N_PORT. Behind a proxy, n8n runs on plain http on port 5678 while the proxy serves 443, so the URL n8n builds, and sends to Telegram, is the internal one.

How to confirm it: the browser shows https://n8n.example.com, but the Telegram Trigger's webhook URL shows http://, an internal host, or :5678.

The fix: set the public URL explicitly. In Docker Compose:

services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    environment:
      - N8N_WEBHOOK_URL=https://n8n.example.com/
      - N8N_PROXY_HOPS=1

The proxy must pass X-Forwarded-For, X-Forwarded-Host and X-Forwarded-Proto to n8n.

Which variable name. The n8n docs say N8N_WEBHOOK_URL is available from n8n 2.30.0 and replaces WEBHOOK_URL, which is deprecated from 2.35.0 and logs a deprecation warning. On older versions, including every n8n 1.x release, use WEBHOOK_URL. The Telegram common issues page and most forum answers still say WEBHOOK_URL. That is right for older versions and not wrong yet on newer ones, but it is the deprecated name. Check your version on the About n8n page, under Help in the editor's bottom-left menu, and pick accordingly.

Cause 3: The Variable Is Set, but to the Wrong Value

In the second big thread the user set:

WEBHOOK_URL=http://<local_ip_address>:5678/

That cannot work. It is http, and a local IP is not reachable from Telegram. The common slips:

  • http instead of https. The value must start with https://.
  • Port 5678 left in the URL. Telegram's API lists the supported webhook ports as 443, 80, 88 and 8443. An HTTPS URL ending in :5678 gets a different error, Bad Request: bad webhook: Webhook can be set up only on ports 80, 88, 443 or 8443. Point the variable at the proxy or tunnel address, which uses 443, not at n8n's own port.
  • The container was not recreated. n8n reads environment variables at startup. Editing docker-compose.yml does nothing until you run docker compose up -d, which recreates the container when its configuration changes.
  • A self-signed certificate. Telegram accepts one only if the certificate is uploaded with setWebhook. The n8n Telegram Trigger docs describe no option for that, so use a publicly trusted certificate, such as one your proxy gets from Let's Encrypt.

How to confirm it: check what the running container actually has:

docker exec n8n printenv | grep WEBHOOK_URL

Cause 4: You Rely on n8n's Built-In --tunnel

Older guides, and the 2023 thread, fix this with n8n start --tunnel, which gave a local instance a temporary public URL. That advice is out of date. In March 2026 n8n announced the tunnel service is discontinued: the option was already removed in n8n 2, and starting a v1 instance with --tunnel now times out with an error. n8n recommends a third-party provider such as Cloudflare Tunnel or ngrok instead.

The 2023 thread also found that n8n 1.1.1 set tunnel URLs incorrectly, fixed in a later release. If you are on a very old 1.x version, upgrade first.

The fix: follow Cause 1 with ngrok or Cloudflare Tunnel.

Check What Telegram Actually Registered

Telegram will tell you the URL it holds for your bot and the last delivery error. Replace the token with your bot token:

curl "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getWebhookInfo"

The fields that matter, from the Bot API reference:

  • url: the registered webhook. Empty means none is set. After the fix it should be your HTTPS address with /webhook/ (published) or /webhook-test/ (testing) in the path.
  • last_error_message: the most recent delivery failure. If registration worked but messages still do not arrive, this says why.
  • pending_update_count: updates waiting to be delivered.

Two related behaviours, both from n8n's common issues page. Telegram allows only one webhook per bot, so testing and publishing overwrite each other's registration: a workflow that works in test stops working in production, or the reverse. Use a separate bot for testing, or unpublish while you test. And if the trigger hangs on "waiting for trigger event" behind a proxy, enable websocket proxying.

If the HTTPS error is gone but messages get a 404, see The requested webhook is not registered. If n8n cannot reach the Telegram API at all, see connect ECONNREFUSED.

Still Broken? Check These in Order

  1. The webhook URL shown in the Telegram Trigger starts with https:// and has no :5678.
  2. printenv inside the container shows the variable name that matches your n8n version.
  3. Opening https://your-domain/healthz from a phone on mobile data returns a response, so the address is public.
  4. The certificate is publicly trusted, not self-signed.
  5. You re-ran the test or republished after restarting, so setWebhook was called again.
  6. getWebhookInfo shows your HTTPS URL and no last_error_message.
  7. No other workflow or bot framework uses the same bot token, since only one webhook per bot is allowed.

How to Stop It Coming Back

Set the webhook URL variable in your compose file on day one, before the first trigger. Every webhook-based trigger depends on it, not just Telegram.

Use a stable address. A domain with a proxy, or a named tunnel with a fixed hostname. Free tunnel addresses that change on restart bring this error back every time.

Keep one bot for testing and one for production. It removes the test-versus-production webhook fight entirely.

Re-check after upgrades. If you move past n8n 2.35.0, rename WEBHOOK_URL to N8N_WEBHOOK_URL so the deprecation does not become a breakage later.

Running n8n yourself means owning details like these. Our guide to the true cost of self-hosting n8n covers what you take on, and the self-hosting glossary entry covers the trade-off. Webhooks versus polling is explained in polling vs webhook, and the n8n review covers the platform. The n8n AI Agents course builds chat agents on webhook triggers end to end, then covers memory per user, tools, error handling, and choosing between self-hosted and n8n Cloud when you deploy.

Sources

Checked against n8n's documentation, Telegram's Bot API and the n8n community forum on 17 November 2026.

FAQ

What does "An HTTPS URL must be provided for webhook" mean in n8n?
The Telegram Trigger tried to register n8n's webhook URL with Telegram, and Telegram rejected it because it is not HTTPS. n8n built an http or localhost URL from its own settings. Give n8n a public HTTPS address and set the webhook URL variable to it.
Can I use the Telegram Trigger on localhost?
Not directly. Telegram must reach your instance over public HTTPS. Run a tunnel such as ngrok or Cloudflare Tunnel, set N8N_WEBHOOK_URL (or WEBHOOK_URL before n8n 2.30.0) to the tunnel's https address, restart n8n and re-register the trigger.
Should I use WEBHOOK_URL or N8N_WEBHOOK_URL?
The n8n docs say N8N_WEBHOOK_URL is available from 2.30.0 and replaces WEBHOOK_URL, which is deprecated from 2.35.0. On earlier versions, including all of n8n 1.x, use WEBHOOK_URL. Check your version on the About n8n page, under Help in the editor's bottom-left menu.
Does n8n start --tunnel still work?
No. n8n has discontinued its tunnel service. The option was removed in n8n 2, and starting a v1 instance with --tunnel now times out with an error. n8n recommends Cloudflare Tunnel or ngrok instead.
Why do I now get "Webhook can be set up only on ports 80, 88, 443 or 8443"?
Your URL is HTTPS now, but includes a port Telegram does not accept, usually :5678. Telegram's API supports webhooks on ports 443, 80, 88 and 8443 only. Point the webhook URL variable at your proxy or tunnel address, which uses 443.
Why does my Telegram workflow work in test but not when published?
Telegram allows one webhook per bot, so the test URL and production URL overwrite each other. n8n's docs suggest a separate bot for testing, or unpublishing the workflow while you test and republishing after.
How do I see which webhook URL Telegram has for my bot?
Call https://api.telegram.org/bot<token>/getWebhookInfo. The url field shows the registered webhook and last_error_message shows the most recent delivery failure.

If this resonated

Module 02 is the long version of this post.

Eval set, refusal pattern, kill switch. Build it in a weekend.

All postsLast verified 2026-11-17

Done for you

Want this built for your business?

Tell us the workflow. We scope, build, and ship the agent with guardrails and the numbers to prove it worked. The scoping call is free.

Free scoping call. You own the code.

Request a scoping call