Simple telegram message with GitHub Actions

by Christian Fei @ 2019-08-29

206 words, 1 minute reading time

#post #js #featured #tutorial 

this

Let's get straight to the point.

After reading this, you'll be able to send a telegram message to a chat_id with one command.

secrets

set the following secrets in the settings of your repository where you want to run the workflow:

TELEGRAM_TOKEN

you'll get this token from the BotFather, just issue the /newbot command.

TELEGRAM_CHANNEL

this is the receivers chat_id, you can find out yours with @userinfobot.

github actions workflow

this is what is looks like. we're going to use a small npm package simple-telegram-message

name: telegram message example
on: [push]
jobs:
  build_deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/[email protected]
      - name: install
        run: |
          npm install
      - name: send-telegram-message
        env:
          TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
          TELEGRAM_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL }}
          TELEGRAM_TEXT: "Deployed to https://christianfei.com"
        run: |
          npx [email protected]

et voilĂ 

github-actions-tg-bot.png

this

Leave a comment

Better web scraping with node.js My blogging stack in 2020 Run cypress integration tests with github actions workflow Simple telegram message with github actions Deploy eleventy site with github actions on aws s3 Simple ad and trackers blocking with dns Build for a slow connection Upgrade mongodb 3 to 4 on ubuntu Publishing org scoped npm packages with travis A story about npm publish / unpublish