You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过GitHub Actions向Telegram群组指定主题发推送通知

实现GitHub Actions推送Telegram群组指定主题通知

要将消息发送到Telegram群组的指定主题,你需要在appleboy/telegram-action的配置中添加message_thread_id参数,具体步骤如下:

1. 获取群组主题的Thread ID

  • 打开Telegram目标群组的指定主题,点击顶部的主题名称
  • 点击「分享」按钮,选择「复制链接」
  • 链接格式类似https://t.me/your_group_name/12345,其中最后的数字12345就是该主题的Thread ID

2. 在GitHub仓库添加Thread ID密钥

  • 进入你的GitHub仓库,依次点击「Settings」→「Secrets and variables」→「Actions」
  • 点击「New repository secret」,创建名为TELEGRAM_THREAD_ID的密钥,值为刚才获取的Thread ID

3. 修改GitHub Actions配置文件

更新你的tg-notify.yml,在with块中添加message_thread_id字段:

name: tg-notify
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Update status
      uses: appleboy/telegram-action@master
      with:
        to: ${{ secrets.TELEGRAM_TO }}  # 填写群组ID(负数形式,如-100xxxxxx)
        token: ${{ secrets.TELEGRAM_TOKEN }}
        message_thread_id: ${{ secrets.TELEGRAM_THREAD_ID }}  # 新增的主题Thread ID
        message: |
          Github_Updates:
          Push_Commit ⚒:
          ${{ github.event_name }} commit in ${{ github.repository }} by "${{ github.actor }}". [${{github.sha}}@${{ github.ref }}]

注意事项

  • 确保TELEGRAM_TO是你的Telegram群组ID(必须为负数,比如-100123456789),而非个人ID
  • 你的Telegram机器人必须已加入目标群组并拥有发送消息的权限

内容的提问来源于stack exchange,提问作者Issasafar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 10:58:29