GitHub Action for sending Telegram notification messages with topic (forum) support.
- ✅ Send text messages (Markdown or HTML format)
- ✅ Send to forum topics using
message_thread_id - ✅ Send photo attachments
- ✅ Send document attachments
- ✅ Disable link previews
- ✅ Silent notifications
name: Telegram Notification
on: [push]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send Telegram Message
uses: Salmansha08/telegram-github-action@main
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: |
🚀 New push to ${{ github.repository }}
Commit: ${{ github.event.head_commit.message }}
Author: ${{ github.actor }}For supergroups with topics enabled, you can send messages to a specific topic:
- name: Send to CI Topic
uses: Salmansha08/telegram-github-action@main
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message_thread_id: ${{ secrets.TELEGRAM_THREAD_ID }}
message: |
✅ Build #${{ github.run_number }} successful!- name: Send Photo
uses: Salmansha08/telegram-github-action@main
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message_thread_id: "123" # Optional: send to topic
photo: "./screenshot.png"
message: "Build screenshot"- name: Send Document
uses: Salmansha08/telegram-github-action@main
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
document: "./build-report.pdf"| Parameter | Required | Description |
|---|---|---|
to |
✅ | Telegram chat ID (user, group, or channel) |
token |
✅ | Telegram Bot API token |
message |
❌ | Message text to send |
message_file |
❌ | Path to file containing message (overrides message) |
message_thread_id |
❌ | Topic ID for forum supergroups |
photo |
❌ | Path to photo file to send |
document |
❌ | Path to document file to send |
format |
❌ | Message format: markdown or html |
disable_web_page_preview |
❌ | Disable link preview (default: false) |
disable_notification |
❌ | Send silently (default: false) |
- Message @BotFather on Telegram
- Send
/newbotand follow the instructions - Copy the token provided
For private chats or groups:
curl https://api.telegram.org/bot<TOKEN>/getUpdatesLook for "chat": {"id": 123456789} in the response.
For forum topics:
- Send a message to the topic from Telegram app
- Right-click the message → "Copy Message Link"
- Link format:
https://t.me/c/<chat_id>/<thread_id>/<msg_id> - The
<thread_id>is yourmessage_thread_id
This action uses GitHub Environment Secrets for secure credential storage.
- Go to your repository on GitHub
- Navigate to Settings → Environments
- Click New environment
- Name it
Telegram Github Action(or your preferred name) - Click Configure environment
In the environment configuration page:
- Scroll to Environment secrets
- Click Add environment secret
- Add the following secrets:
| Secret | Description |
|---|---|
TELEGRAM_BOT_TOKEN |
Bot API token from BotFather |
TELEGRAM_CHAT_ID |
Chat ID to send messages to |
TELEGRAM_THREAD_ID |
(Optional) Topic ID for forum groups |
Add the environment field to your workflow job:
jobs:
notify:
runs-on: ubuntu-latest
environment: "Telegram Github Action" # ← Add this line
steps:
- name: Send Telegram Message
uses: Salmansha08/telegram-github-action@main
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: "Hello from GitHub Actions!"Note: The
environmentname must match exactly with the environment you created in Step 1.
MIT License - see LICENSE file for details.
Based on appleboy/telegram-action, rewritten with native topic support.