Issues in telegram section


#1

Could any one help whether I have entered my chat and channel id correctly

It always shows output as error code 404.the output pic is here below

I want to know whether the error happened due to configuration or code part…


#2

@shivarajendran1999 Can you share your code and a screenshot of the chat ID on Telegram app?


#3

@shivarajendran1999 Also, has the bot been added to the channel as an admin?


#4

Yes sir

Sir have I entered the bot and channel id correctly
(doubt)


#5


#6

def telegram_bot_sendtext(bot_message):
bot_token = ‘TELEGRAM API’
bot_chatID = ‘CHAT ID’
send_text = ‘https://api.telegram.org/bot’ + bot_token + ‘/sendMessage?chat_id=’ + bot_chatID + ‘&parse_mode=Markdown&text=’ + bot_message
response = requests.get(send_text)
return response.json()

please indent the lines properly before using it
and also change the function call statement inside while loop

use this function instead of the send_telegram_message function
it does not has try catch segment but it works
and you can always include try catch segment if you want


#7

@shivarajendran1999 It seems there is something incorrect with your config.
You might have mistaken O for 0 or I for 1 etc. This error only occurs when the config is incorrect.


#9

@shivarajendran1999 your chat id will be the permanent link of your telegram account and the channel id will be the http-Api token given on bot father chat section…
Let me know if this work


#11

i am getting this output(error 401 and unauthorized). can anyone help.


#12

@janavi.mohite Seems you have made an error in either your Chat ID or the Bot ID. Please check them again.


#13

i have checked, but it is giving same error.


#14

@janavi.mohite Please check if you have made any error by confusing O with 0 or I with 1 etc. This is another common mistake.