Sending alerts about results of deployment to Telegram chat.

Are you familiar with situation when your deploy process takes several minutes and you're refreshing your page with workflows waiting for ✅ ? With that feature you'll be notified about result of deployment right in Telegram.

Sending alerts about results of deployment to Telegram chat.

Are you familiar with situation when your deploy process takes several minutes and you're refreshing your page with workflows waiting for ✅ ? With that feature you'll be notified about result of deployment right in Telegram.


Prerequirements

I expect you to have:

  • telegram bot with TELEGRAM_TOKEN
  • some GitHub Actions scripts for deploying your code

Set up secrets of your repository

  1. Go to repository
  2. Settings
  3. Press New repository secret
  4. Type ALERTING_TELEGRAM_TOKEN in name
  5. Type your TELEGRAM_TOKEN from telegram bot into value field.
  6. Press Add secret
  7. Add TELEGRAM_LOG_CHAT_ID the same way and put telegram chat id of yourself or of your log chat, where log messages will be sent to.
    Screenshot-2021-12-27-at-01.46.56

New .yml file in .github/workflows

To receive alerts, we need to create new .yml file, which be executed after our deployment.
So, let's create file, for example, tg_alert.yml in .github/workflows folder with following content:

Basically, it means following:

  1. Look at result of deploy workflow after its completing
  2. If success, then send Successfully deployed 👍✅ to TELEGRAM_LOG_CHAT_ID
  3. Else, send Failed to deploy 👎❌

As a result you will get this:
Screenshot-2022-02-07-at-11.24.01

Voilà 🥳

You're receiving telegram alerts after your deployment