Telegram bot project 'name response not identified and 401 unauth error

Hi, I am still getting this error of Unauthorized telegram response I saw the other thread on this so I recreated the channel and bot and did the required changes in the conf file but it’s still not working can anyone please help me out here?




Please check your telegram_bot_id .If you still face same issue then you can change platform(jupyter notebook) or you can check bot_doc

In your functions, response is declared inside them which means that it has local scope, i.e., it can only be used in those functions. In the first while True block, you are trying to use the response variable which is not defined in that block. That is why you are getting an error that response is not defined. If you want to use the response value from the functions, return that value also and store it an a variable, and then use that variable to show the response text.

Im not using response variable inside while true block. All response calls are used in the functions ive defined.

In your step 2 of the first while True block, in the third line you are using print(response.text). As response is not defined inside that block, you cannot use it without initializing it first.

Its not in while true block but in function send_telegram_message. In this function i have defined response

Try to debug which block is raising the exception as you have the error message same for the send_telegram_message function and the first while True block. Also the response in the console shows the description as Unauthorized, so better to check the conf file for correct url.

I got it working but the response error is still there.

Hi @Tabrez_Ahmed,
on line 62 in the 3rd Screenshot you have written print(response.text) but the variable response is not defined in the scope of the while True: block. That’s why you are seeing this error. Do let me know if you need any other help.