Send (text) messages to a Telegram chat from GitHub Actions.
token
: Required - Telegram bot's authorization token. Use GitHub secrets.to
: Required - Unique identifier or username of the target Telegram chat.message
: Optional - Text message to send. If omitted, bot's information is fetched.parse-mode
: Optional - Mode for parsing text entities (markdown
orhtml
).disable-web-page-preview
: Optional - Disables link previews.disable-notification
: Optional - Sends message silently.protect-content
: Optional - Protects message content from forwarding/saving.dry-run
: Optional - If set, do not send a real message but print the details instead.
name: Send Telegram Message
on: [push]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send Telegram Message
uses: cbrgm/telegram-github-action@v1
with:
token: ${{ secrets.TELEGRAM_TOKEN }}
to: ${{ secrets.TELEGRAM_CHAT_ID }}
message: "New commit pushed to repository"
This workflow triggers a Telegram message notification when a new tag is published in the repository.
name: Inline Message Workflow
on:
push:
branches: [main]
jobs:
send-inline-message:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Send Inline Telegram Message
uses: cbrgm/telegram-github-action@v1
with:
token: ${{ secrets.TELEGRAM_TOKEN }}
to: ${{ secrets.TELEGRAM_CHAT_ID }}
message: |
New commit by ${{ github.actor }}!
Commit: ${{ github.event.head_commit.message }}
Repository: ${{ github.repository }}
View changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
This workflow triggers a Telegram message notification when a new release is published in the repository.
name: Release Notification
on:
release:
types: [published]
jobs:
notify-on-release:
runs-on: ubuntu-latest
steps:
- name: Send Telegram Notification on New Release
uses: cbrgm/telegram-github-action@v1
with:
token: ${{ secrets.TELEGRAM_TOKEN }}
to: ${{ secrets.TELEGRAM_CHAT_ID }}
message: |
🚀 New Release Published!
Release Name: ${{ github.event.release.name }}
Tag: ${{ github.event.release.tag_name }}
Actor: ${{ github.actor }}
Repository: ${{ github.repository }}
Check it out: ${{ github.event.release.html_url }}j
- Chat with BotFather on Telegram.
- Follow prompts to name your bot and get a token.
- Store the token as a GitHub secret (
TELEGRAM_TOKEN
).
Run the following command:
curl https://api.telegram.org/bot<token>/getUpdates
Replace with your bot's token to find your chat_id
(TELEGRAM_CHAT_ID
).
You can build this action from source using Go
:
make build
- Contributions Welcome!: Interested in improving or adding features? Check our Contributing Guide for instructions on submitting changes and setting up development environment.
- Open-Source & Free: Developed in my spare time, available for free under Apache 2.0 License. License details your rights and obligations.
- Your Involvement Matters: Code contributions, suggestions, feedback crucial for improvement and success. Let's maintain it as a useful resource for all 🌍.