String.sg
Published in

String.sg

Debugging (serverless) deployment on Google App Script and Telegram Bot

Ensuring that you can indeed deploy the latest code from app script on Telegram

Configuring Telegram Bots with Google App Script

After nearly pulling my remaining hair out for an evening, I learnt that App Script does not deploy the latest version of my code on Telegram — at least, not as seamlessly as the YouTube Videos demonstrated (timestamped 2017, you could just click update deployment and the latest deployment will update)

To debug, I tried the following:

  1. Re-issuing a Telegram Bot API Key
  2. Re-deploying Google App Script as a web app and updating the webhook given to the Telegram Bot

The former did not work but the latter did. But this meant that whenever I updated my code as a new web app, I had to also update the webhook supplied to the Telegram Bot.

So referencing Telegram Bot API SDK , there are 3 commands that are helpful written in sequence. You can make these API calls directly in your browser:

  1. setWebhook?remove: remove the past webhook in order to update to the latest one
  2. setWebhook?url={url}: configure the Webhook for your Telegram bot
  3. getWebhookInfo: check configuration

The exact URL that you can type in your browser to make those API calls are also in the Github gist above.

If it is set correctly, you should see the following in your browser:

Success page after pointing your browser to https://api.telegram.org/bot{bot API token}/setWebhook?={URL}

Hope this helps you to debug if you are deploying Google App Script with Telegram!

If you are looking for inspiration to build Telegram bots, you can also check out this article to explore about other use cases for Telegram Bots.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kahhow

Kahhow

171 Followers

Educator interested in data science, dance and full stack development