返回命令列表
网关与平台hermes send

hermes send 命令 — 完整参考与示例

hermes send 完整参考:从 shell 脚本向已配置的消息平台发送文本,无需 Agent 循环、LLM,也无需为机器人令牌平台运行网关。

2026年7月27日

概述

hermes send 将任何 shell 脚本中的文本发送到 Hermes 已配置的消息平台。它复用网关的平台凭证(~/.hermes/.env~/.hermes/config.yaml)。无需 LLM,无需 Agent 循环,对于 Telegram、Discord、Slack、Signal 等机器人令牌平台,也无需运行网关。

hermes send [-t TARGET] [-f PATH] [-s LINE] [-l] [-q] [--json] [message]

选项

选项 说明
message 消息正文。如果省略,则从 --file 或 stdin 读取。
-t TARGET, --to TARGET 投递目标。格式:platformplatform:chat_idplatform:chat_id:thread_idplatform:#channel-name
-f PATH, --file PATH PATH 读取消息正文。使用 - 强制从 stdin 读取。
-s LINE, --subject LINE 在消息正文前添加主题/标题行。
-l, --list 列出可用目标。可选过滤:hermes send --list telegram
-q, --quiet 成功时抑制 stdout,仅返回退出码。
--json 输出原始 JSON 结果而非人类可读格式。

示例

# 发送简单消息
hermes send --to telegram "deploy finished"

# 从其他命令管道发送
echo "RAM 92%" | hermes send --to telegram:-1001234567890

# 发送文件内容作为消息
hermes send --to discord:#ops --file /tmp/report.md

# 添加主题行
hermes send --to slack:#eng --subject "[CI]" --file build.log

# 发送媒体附件
hermes send --to telegram "MEDIA:/tmp/chart.png"

常见场景

CI/CD 通知

hermes send --to telegram "Build passed on $(date)"

Cron 任务告警

echo "Nightly backup completed" | hermes send --to discord:#ops

列出目标

hermes send --list
hermes send --list telegram

退出码

  • 0 — 发送成功
  • 1 — 投递或后端错误
  • 2 — 用法错误

提示

  • 在消息正文中使用 MEDIA:/path/to/file 来附加图片或文档。
  • 不同平台的目标格式不同,使用 --list 查看可用目标。
  • 脚本中使用 --quiet 避免污染 stdout。
  • 与其他自动化工具链式调用时,使用 --json

Explore All Commands

Browse the full command reference with search and category filters.

返回命令列表