I prepared a public channel.
I created a bot using botFather.
I made the bot as the administrator of public channel.
then I made the following HTTP GET request without success:
var myUrl = ‘https://api.telegram.org/bot[MY_BOT_TOKEN]/sendmessage?chat_id =MY_CHANNEL_NAME&text=’ + myMessage;
The fetch command returns this error:
Exception: Invalid argument: https://api.telegram.org/bot(1246662861:AAFGejYXvmstfH-
Please somebody help me to solve this problem.
I thank you very much for soonest response.
You have to append your token directly to “https://api.telegram.org/bot” I can see an opening bracket “(” in the error message url.
If your bot token is “Je3nf5Il6rHfDN340” then the URL will be:
Je3nf5Il6rHfDN340/sendmessage?chat_id= MY_CHANNEL_NAME&text= myMessage
first: remove the bracket “(”
2nd: place this token in the ‘telegram_bot_id’ variable in the conf.py file correctly.
By correctly i mean it should be placed as
(important is u should place ‘bot’ word before https.
Like this reply if you got it solved
thank you very much.
it was realy good.
Hello i’m trying to send message to my channel directly in my browser using this URL https://api.telegram.org/botMYTOKETBOT?chat_id=MYCHANNEL_NAME&text=myMESSAGE
I created a bot with botfather and i obtein the token(MYTOKETBOT), with that i achieved send message to my bot from google script, but i can’t send message to my telegram channel.
So i have a question:
- The bot token you use is the same token for the channel ?
- The channel have an ID or can i use the name of channel directly?
I solved my problem, setting my channel like public not private, thanks