Hermes Agent 今天凌晨刚提交的新功能
hermes send,让任何脚本的输出都能直达 12+ 消息平台。这意味着你的 cron 作业不再沉默——服务器报警、部署结果、数据报表,全部自动推送到手机上。
为什么你需要 hermes send
如果你在用 AI Agent 做内容创业或自动化运营,你一定遇到过这个场景:
# 凌晨 3 点的 cron 任务跑完了,但你只能在第二天早上才知道结果
0 3 * * * /home/user/scripts/generate_report.sh >> /tmp/report.log 2>&1
日志躺在服务器里,除非你主动去看,否则永远不会主动告诉你 "我成功了" 或者 "我挂了"。
传统的解决方案是:自己写 Telegram Bot API 调用、配置 SMTP 邮件、或者接 PagerDuty。每个平台都要写一遍,代码散落在各个脚本里,维护成本极高。
hermes send 的解决方案:一行命令,所有平台通用。
# 原来需要 30 行的 Telegram API 调用,现在只需:
echo "报告生成完成,收入 +$350" | hermes send --to telegram
hermes send 怎么用
这个命令今天(2026年5月17日)凌晨 00:14 UTC 刚被合入 Hermes Agent 主分支(commit 29b1bd0e,PR #27188)。核心设计理念极其简单:管道输入 → 消息输出。
基础用法
# 发送纯文本
hermes send --to telegram "部署完成 ✅"
# 从管道接收(这才是核心用法)
echo "CPU 92%, 内存 87%" | hermes send --to telegram:-1001234567890
# 发送文件内容
hermes send --to discord:#ops --file report.md
# 带标题发送
hermes send --to slack:#eng --subject "[CI] Build Failed" --file build.log
# 查看所有已配置的目标
hermes send --list
支持的平台(12+)
| 平台 | 类型 | 是否需要 Gateway |
|---|---|---|
| Telegram | Bot-token | ❌ 不需要 |
| Discord | Bot-token | ❌ 不需要 |
| Slack | Bot-token | ❌ 不需要 |
| 飞书 (Feishu) | Bot-token | ❌ 不需要 |
| 钉钉 (DingTalk) | Bot-token | ❌ 不需要 |
| 企业微信 (WeCom) | Bot-token | ❌ 不需要 |
| 微信 (Weixin) | 插件 | ✅ 需要 Gateway |
| Signal | 插件 | ✅ 需要 Gateway |
| 插件 | ✅ 需要 Gateway | |
| Matrix | 插件 | ✅ 需要 Gateway |
| SMS | 插件 | ✅ 需要 Gateway |
| Bot-token | ❌ 不需要 |
关键发现:Bot-token 平台(Telegram/Discord/Slack/飞书/钉钉/企微)不需要运行 Hermes Gateway——直接调用各平台 REST API。只有插件平台(微信/Signal/WhatsApp)才需要 Gateway 提供 adapter 连接。
退出码系统
hermes send --to telegram "hello"
echo $? # 0 = 成功
hermes send --to telegram:invalid-id "hello"
echo $? # 1 = 投递失败(消息发出但平台拒绝)
hermes send --invalid-flag
echo $? # 2 = 用法错误
退出码设计让 hermes send 可以无缝融入 shell 脚本的错误处理:
if ! echo "$alert" | hermes send --to telegram; then
echo "消息发送失败,fallback 到邮件" >&2
echo "$alert" | hermes send --to email:admin@example.com
fi
实战场景:一人公司自动化三件套
场景 1:服务器监控 → 微信/钉钉
#!/bin/bash
# /etc/cron.d/monitor — 每5分钟执行
LOAD=$(uptime | awk -F'load average:' '{print $2}' | cut -d, -f1 | xargs)
MEM=$(free | grep Mem | awk '{printf "%.0f", $3/$2 * 100}')
DISK=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
if [ "$MEM" -gt 90 ]; then
echo "⚠️ [$(hostname)] 内存使用率 ${MEM}% | 负载 ${LOAD} | 磁盘 ${DISK}%" \
| hermes send --to wecom
fi
场景 2:AI 内容生产流水线 → 飞书通知
#!/bin/bash
# 每日内容生产脚本的最后一步
echo "📝 [AI内参] 今日产出报告
━━━━━━━━━━━━━━━
✅ 热点扫描:3 条新发现
✅ 文章生成:2 篇草稿(共 4200 字)
✅ 封面图:2 张(GPT Image 2)
📊 预计阅读:8 分钟
━━━━━━━━━━━━━━━
发布时间:$(date '+%Y-%m-%d %H:%M')" \
| hermes send --to feishu --subject "日报"
场景 3:GitHub Webhook → Discord 运维频道
#!/bin/bash
# 部署脚本的最后一步
COMMIT_MSG=$(git log -1 --pretty=%B | head -1)
AUTHOR=$(git log -1 --pretty=%an)
echo "🚀 部署完成
━━━━━━━━━
📦 Commit: ${COMMIT_MSG}
👤 作者: ${AUTHOR}
🕐 时间: $(date '+%H:%M:%S')
🔗 $(git log -1 --pretty=%H)" \
| hermes send --to discord:#deployments
配置指南:3 步接入飞书/钉钉/企微
Bot-token 平台不需要 Hermes Gateway,配置极其简单。以飞书为例:
Step 1:在 Hermes 配置文件中添加目标
# ~/.hermes/config.yaml
send_targets:
feishu:
platform: feishu
webhook_url: "https://open.feishu.cn/open-apis/bot/v2/hook/xxxxx"
dingtalk:
platform: dingtalk
webhook_url: "https://oapi.dingtalk.com/robot/send?access_token=your-dingtalk-token"
wecom:
platform: wecom
webhook_url: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=your-wecom-key"
telegram:
platform: telegram
bot_token: "123456:ABC-DEF"
chat_id: "-1001234567890"
Step 2:获取各平台 Webhook URL
| 平台 | 获取路径 |
|---|---|
| 飞书 | 群设置 → 群机器人 → 添加机器人 → 复制 Webhook |
| 钉钉 | 群设置 → 智能群助手 → 添加机器人 → 复制 Webhook |
| 企微 | 群设置 → 群机器人 → 添加 → 复制 Webhook |
| Telegram | @BotFather 创建 Bot → 获取 Token → 获取 Chat ID |
Step 3:测试
echo "测试消息 🎉" | hermes send --to feishu
进阶技巧
技巧 1:多平台广播
# 重要告警同时发到所有平台
ALERT="🚨 数据库连接失败 | $(date)"
echo "$ALERT" | hermes send --to telegram
echo "$ALERT" | hermes send --to feishu
echo "$ALERT" | hermes send --to dingtalk
或者用 shell 循环:
for platform in telegram feishu dingtalk; do
echo "$ALERT" | hermes send --to "$platform"
done
技巧 2:条件路由
# 严重告警走全平台,普通通知只走一个
if [ "$SEVERITY" = "critical" ]; then
echo "$MSG" | hermes send --to telegram
echo "$MSG" | hermes send --to feishu
else
echo "$MSG" | hermes send --to telegram
fi
技巧 3:附带 Markdown 报告
# 将 Markdown 文件直接作为消息发送
hermes send --to telegram --file daily-report.md
Telegram 和 Discord 原生支持 Markdown 渲染,效果比纯文本好很多。
注意事项和已知限制
-
插件平台需要 Gateway:微信、Signal、WhatsApp 等插件平台仍然需要运行 Hermes Gateway。如果你只需要 Bot-token 平台(飞书/钉钉/企微/Telegram/Discord/Slack),完全不需要 Gateway。
-
Webhook URL 安全:配置文件中包含各平台的 Webhook URL 和 Token,建议设置
chmod 600 ~/.hermes/config.yaml防止泄露。 -
消息长度限制:各平台对单条消息有长度限制(Telegram 4096 字符,飞书 20KB,钉钉 20KB)。超长内容建议发送文件链接而非全文。
-
频率限制:飞书机器人每分钟最多 20 条,Telegram Bot 每秒最多 30 条。高频告警场景需要做聚合。
对 AI 创业者的价值
作为一个运营着全套 AI 内容生产流水线的创业者,hermes send 解决了三个核心痛点:
| 痛点 | 传统方案 | hermes send |
|---|---|---|
| 多平台通知 | 每个平台写一套 API 代码 | 统一命令 |
| Cron 作业盲区 | 看日志才知道结果 | 主动推送结果 |
| 告警基础设施 | 需要部署 Sentry/PagerDuty | 零额外服务 |
特别是 Bot-token 平台不需要 Gateway 这个设计——意味着你可以在最廉价的 VPS($5/月)上跑完整的内容生产 + 通知流水线,不需要额外的基础设施成本。
总结
hermes send 是一个典型的"小而美"功能:做的事情很简单(把管道输入发到消息平台),但解决的是 AI 自动化运营中的真实痛点。
如果你是 AI 创业者,现在就可以:
1. 更新 Hermes Agent 到最新版(含 PR #27188)
2. 花 10 分钟配置 2-3 个消息目标
3. 给你的关键 cron 作业加上 | hermes send 收尾
从此,你的 AI Agent 流水线不再是"黑盒"——每完成一步,手机都会收到通知。
参考来源:Hermes Agent PR #27188 · 配置文档
