Publish message to telegram Public Channel

Dear All;
I have developoed an analysis tool using Google Apps Script which utilizes Javascript. I need to publish the output to a public telegram channel. I did followings:

  1. I prepared a public channel.

  2. I created a bot using botFather.

  3. I made the bot as the administrator of public channel.

  4. 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;
    ** UrlFetchApp.fetch(myUrl);**

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.

Best Regards
Javad

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:
https://api.telegram.org/bot
Je3nf5Il6rHfDN340/sendmessage?chat_id= MY_CHANNEL_NAME&text= myMessage

first: remove the bracket “(”
https://api.telegram.org/bot(1246662861:AAFGejYXvmstfH-
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
telegram_bot_id=“bothttps://api.telegram.org/bot(1246662861:AAFGejYXvmstfH-”
(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.