Issue with Reconnecting Telegram Bot to n8n Workflow After Ngrok URL Change

Hello,

I have hosted my n8n instance using Docker Desktop and am using Ngrok to expose the local instance to the internet. Initially, I created a Telegram-based workflow in n8n, and it functioned as expected.

However, after stopping the workflow and restarting it later, Ngrok generated a new public URL. When I accessed the n8n UI through this new URL, I noticed that the Telegram Trigger node was still pointing to the previous (now invalid) webhook URL.

I attempted the following steps to resolve the issue:

  1. Deleted the existing Telegram Trigger node and re-added it.
  2. Tried resetting the webhook URL using the setWebhook method.
  3. Generated a new Telegram bot access token and updated it in the workflow.
  4. Attempted various community-recommended methods to refresh the webhook URL.

Despite these efforts, the Telegram bot continues to point to the old webhook URL, and I am unable to trigger the workflow using the new Ngrok address.

Could someone please guide me on how to reliably reconnect or update the Telegram bot webhook each time the Ngrok tunnel restarts and generates a new URL? Is there a standard procedure or recommended best practice for this recurring use case?

Thank you in advance for your support.

1 Like

Have you changed Configuring queue mode | n8n Docs and restarted the n8n node?

This should change all nodes webhook URLs.

export WEBHOOK_URL=https://your-webhook-url.com

you could also look into cloudflare tunnel, than ngrok. But ensuring this env var is set, and a restart should help fix.

Hi Mr. @King_Samuel_David,
Since I am beginner level enthusiast trying to develop cool stuff so I don’t have any idea what approach are you suggesting me to work on. Nevertheless, appreciated for the suggestion and if possible could you kindly elaborate into.

1 Like

@Jiwan_Rai Sure, you mentioned your using dockers, can you share your yml file? or are you creating containers via dockers command?

I think you can just apply which is an environment variable

export WEBHOOK_URL=https://your-webhook-url.com

if you set as a env var, and restart n8n, then this should pickup the new URL that was changed by ngrok in all endpoints like your telegram node.

btw ngrok do offer one free static domain I believe too, but lets resolve this main issue.

I have set environment variables using the “Run a new container” GUI (Graphical User Interface) as shown in your screenshot. I don’t have any docker-compose.yml file as such.

1 Like

Thanks okay, and what setting did you use? This will help see your setup so we can determine what webhook url your system is using, once we change this it should fix the issue.

Also, when you make a new

What does it display? does it display the new ngrok or old ngrok url?

Following are the settings
(N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE
N8N_EDITOR_BASE_URL
WEBHOOK_URL
N8N_DEFAULT_BINARY_DATA_MODE

2 Likes

Thanks @Jiwan_Rai, and you’re doing great for someone just getting started.
You’re on the right path using the Docker GUI. Since you’re not using docker-compose.yml, the key thing is making sure that WEBHOOK_URL is updated each time your Ngrok URL changes.

Here’s the quick version of what to do:

Start Ngrok and copy the new HTTPS URL it gives you.

In Docker Desktop, go to your n8n container → Edit it).

Under Environment Variables, set or update:

WEBHOOK_URL = https://your-new-ngrok-url.ngrok-free.app

Save changes and restart the container.

Open your n8n UI and double-click the Telegram Trigger node, it should now show the correct updated URL.

@King_Samuel_David there is no option for me to edit. In the image its showing old WEBHOOK_URL and N8N_EDITOR_BASEpURL which I have sent while configuring N8N first time with docker desktop container. I cannot change in the n8n docker desktop container.

1 Like

Okay, I would recommend to switch over to docker compose, it’s easier to manage too, but for now, you might need to create the instance again with these correct details, btw if you done work on it did you export?

I am planning to switch to docker compose. I tried Render but its spinning down even though I tried using cronjob.
I appreciated for your support and I look forward to get your help in future aswell.

1 Like

One key thing is, ensure you use volume for your data, otherwise it won;t persist and you may lose data if you restart or redeploy the instance etc, so make sure you set storage.