Telegram Webhook does not work

Describe the problem/error/question

Telegram Webhook does not work. I have been scratching for past week to get this fixed but none of the answers here for similar issue worked for. me.
Below i have set with docker environment
- WEBHOOK_URL=https://n8n.xxxxxx.in/
- WEBHOOK_TUNNEL_URL=https://n8n.xxxxxx.in
- VUE_APP_URL_BASE_API=https://n8n.xxxxxx.in/
I am using nginx proxy and config has websockets enabled. I tried with SSE it does not work.

location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
client_max_body_size 50m;
client_body_buffer_size 1m;
proxy_read_timeout 600s;
proxy_buffering off;
proxy_cache off;
proxy_pass http://host:port;
}

location ~ ^/(webhook|webhook-test) {
    proxy_set_header Connection '';
    chunked_transfer_encoding off;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Frame-Options SAMEORIGIN;
    proxy_buffering off;
    proxy_cache off;
    proxy_pass http://host:port;
}

What is the error message (if any)?

It just waits “Listening for test event” no error what so ever

Please share your workflow

It pretty simple. I added telegram message trigger and w

Share the output returned by the last node

Information on your n8n setup

  • **n8n version: 1.36.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): Docker with Nginx reverse proxy
  • **Operating system: debian

I have tried this with cloud version and of course it works but it does not work with my selfhosted version.

Hey @isunny,

Welcome to the community :tada:

I suspect the issue will be with your nginx configuration, I would start by removing the location ~ ^/(webhook|webhook-test) { section as you don’t really need it.

From there I would update the / location to use the below which we know works then make changes from there.

location / {
    proxy_pass http://127.0.0.1:5678;
    proxy_set_header Connection 'Upgrade';
    proxy_set_header Upgrade $http_upgrade;
    proxy_http_version 1.1;
  }

Thanks for the reply. I updated to this and still does not work. When i test the flow it just keeps waiting for trigger and nothing happens.

In my flow i just have a telegram trigger event.

Hey @isunny,

That is unusual, Do you already have a webhook registered for the telegram bot you are using?

Hi Yes i have registered using the production Webhook URL by calling the below URL and got the response it is registered.

Is there anything else to be done ?

https://api.telegram.org/bot{my_bot_token}/setWebhook?url=

OK after little digging i found that telegram shows this error after setting webhook
“SSL error {error:0A000086:SSL routines::certificate verify failed}”
Once i trigger the event, the webhook URL is removed.
I am using a letsencrypt SSL.

Ok I have managed to fix this by using different SSL and in Nginx it requires full chain to be set.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.