N8n basic auth and telegram

I’m using basic auth for n8n and trying to create telegram bot by using telegram trigger. Seems like everything working fine exept that when telegram trying to send something on webhook, it gets 401 'cause of basic auth. By seaching on internet i got nothing, so my question is: Can i somehow disable basic auth just for telegram trigger node? Or am i doing something wrong? Thx for help

Hey @Jeinara!

Welcome to the community :tada:

Are you talking about the Basic Auth that n8n uses? If yes, it doesn’t have to do anything with the Telegram nodes. The basic auth allows you to secure your n8n instance. Each node have their own credentials which are independent of the Basic Auth credentials of n8n. I hope this was helpful :slight_smile:

I would suggest you to go through this blog: Creating Telegram Bots with n8n, a No-Code Platform. It will help you build your automation with Telegram. If you still have any problem please let me know :slight_smile:

Hi, thx for reply, @harshil1712!
Yes, im talking about Basic Auth for n8n, N8N_BASIC_AUTH_ACTIVE = true - that one.
The thing is… When i’m trying to curl my telegram webhook (wich registered by telegram trigger, i’m just copying it) via console like “curl http://example.com/webhook/uid” - i’ve got 401. When i’m trying to get it via browser - i’ve got basic auth window and with n8n creds i can go in. Is this really nothing to do with N8N_BASIC_AUTH?
Workflow was created by the help of the blog that you sended, unfortunatly i cant find there why i’m facing this authorisatoin problem in my requests.

The thing is, you can also set basic authentication for a Webhook node. If you did and are not providing the credentials, then you will get a 401. So, you have two options

1 - Remove the basic authentication for the Webhook node (check image below).
2 - Leave it and send the correct credentials.

I can’t find any of thouse setting in telegramm trigger Telegram Trigger | Docs wich i use to create webhook by the instruction in this blog Creating Telegram Bots with n8n, a No-Code Platform. Can i do simmilar thing for telegram trigger or i need to just give up on that and try to use simple Webhook?

Ahh my bad. I do not why I thought you were using the Webhook node. The only thing I can think about it’s to double check that the Telegram access token is correct.

Well, by the info from telegram api (…/token/getWebhookInfo) telegram get the right hook correctly, i checked it twise or more. n8n just wanted basic auth creds for that webhook and i realy cant understand why.

Can you share a screenshot of the workflow you’re building? Also, can you please walk us through the steps you followed to create the workflow?

Ok, just noticed that this will not work unless you are doing a POST (“The method the Telegram Trigger registers”). When you do curl http://example.com/webhook/uid, curl makes a GET request by default. Did you take that into consideration when hitting the endpoint?

@RicardoE105 Ops. No, i did not. But curl -X POST https://example.com/webhook/uid answers 401 too.

@harshil1712 For the sake to make it as simple, as possible. I have this workflow


I was trying to get as much information, as i can, so.
I have my n8n in kuber, with N8N_BASIC_AUTH and WEBHOOK_TUNNEL_URL configured. My url and webhook_tunnel url are different, webhook_tunnel is actually a balancer. Lets say its tunnel com.
And thing are like this:

curl -X POST https: //tunnel com/webhook/
{“code”:401,“message”:“Authorization is required!”}

curl -X POST http: //example com/webhook
{“message”:“Workflow got started.”}

And looks like it is not a balancer problem, 'couse n8n sends www-authenticate: Basic realm=“n8n - Editor UI”

And node configuration like this, if i can call it like this

Hey @Jeinara!

Were you able to solve your issue?

There are a couple of solutions that you can try.

  1. Test if your Webhook URL is set up correctly. To do this I would build a simple workflow with the Webhook node and send a request to it. If you get an error with the Webhook node then we can say that there are some issues with your configurations.
    NOTE: Make sure to use the Test URL and not the Production URL.

  2. Are you using the Test URL in the Telegram Trigger node? If yes, make sure that you execute the node and send the request within 120 seconds. (When you execute trigger nodes manually they listen for requests for 120 seconds)

  3. I tested it with a similar workflow and it worked for me. I was using Postman to make the request, but I am sure using cURL will also result in successful output. I used this guide for reference. Can you make sure your request has all the necessary fields required?

Let us know the result :slight_smile:

Sorry for the late answer. Solution was founded, thanks for your tips, it was really helpful.
Problem was in balancer and its redirection routs. It’s hard for me to explain…
When I curl “webtunnel.com/webhook/uid/webhook” n8n gets from balancer “uid/webhook” URL, not “webhook/uid/webhook”, so n8n cant recognize webhook and send basic auth.
Final answer was founded by activating DEBUG=express:* in the environment.

1 Like