Academy → Practical GuidesOfficial documentation · Arabic guidance

Pipe Script Output to Messaging Platforms

إرسال ناتج سكربت إلى قنوات المراسلة

Intermediate7 min readLesson 162 questions✓ 2026-08-18
Before you read

What this page is, and what it holds.

This page covers Pipe Script Output to Messaging Platforms. You will use hermes send and hermes gateway start here; about 7 minutes to read. Open the channel to yourself first with an allowlist. An open channel means anyone can message your agent.

8sections
7code examples
4tables
2commands
1,112source words
The official one-line description

Send text from any shell script, cron job, CI hook, or monitoring daemon to Telegram, Discord, Slack, Signal, and other platforms using hermes send.

What you will be able to do

Outcomes taken from this page, not a template.

  • Understand what بوابة المراسلة is and when you need it.
  • Run hermes send and hermes gateway start and understand what happens next.
  • Read the table and take only the row that applies to you.
Identifiers you will meet

Exactly as they appear in Hermes.

Commands
  • hermes send
  • hermes gateway start
Page map

Jump to the part you need.

  1. 01Quick Start
  2. 02Argument Reference
  3. 03Message Body Resolution
  4. 04Real-World Examples
  5. 05Does `hermes send` Need the Gateway Running?
  6. 06Listing and Discovering Targets
  7. 07Comparison with Other Approaches
  8. 08Related
The full official page

Nothing summarised away.

The documentation body below is reproduced from the official source so commands and identifiers stay exact. Each section carries a short note describing what it contains.

hermes send is a small, scriptable CLI that pushes a message to any messaging platform Hermes is already configured for. Think of it as a cross-platform curl for notifications — you don't need a running gateway, you don't need an LLM, and you don't need to re-paste bot tokens into each of your scripts.

Use it for:

  • System monitoring (memory, disk, GPU temp, long-running job finished)
  • CI/CD notifications (deploy done, test failure)
  • Cron scripts that need to ping you with results
  • Quick one-shot messages from a terminal
  • Piping any tool's output anywhere (make | hermes send --to slack:#builds)

The command reuses the same credentials and platform adapters that `hermes gateway` already uses, so there's no second configuration surface to maintain.

---

Quick Start

Ordered, practical steps. Run one and confirm it worked before moving on. Commands here: hermes send.

Shell20 lines
# Plain text to the home channel for a platform
hermes send --to telegram "deploy finished"

# Pipe in stdout from anything
echo "RAM 92%" | hermes send --to telegram:-1001234567890

# Send a file
hermes send --to discord:#ops --file /tmp/report.md

# Attach a subject/header line
hermes send --to slack:#eng --subject "[CI] build.log" --file build.log

# Thread target (Telegram topic, Discord thread)
hermes send --to telegram:-1001234567890:17585 "threaded reply"

# List every configured target
hermes send --list

# Filter by platform
hermes send --list telegram

---

Argument Reference

A lookup table. Do not read it all; find the row that applies to you.

FlagDescription
-t, --to TARGETDestination. See target formats ↗.
message (positional)Message text. Omit to read from --file or stdin.
-f, --file PATHRead the body from a file. --file - forces stdin.
-s, --subject LINEPrepend a header/subject line before the body.
-l, --listList available targets. Optional positional platform filter.
-q, --quietNo stdout on success (exit code only — ideal for scripts).
--jsonEmit the raw JSON result of the send.
-h, --helpShow the built-in help text.

Target Formats

FormatExampleMeaning
platformtelegramSend to the platform's configured home channel
platform:chat_idtelegram:-1001234567890Specific numeric chat / group / user
platform:chat_id:thread_idtelegram:-1001234567890:17585Specific thread or Telegram forum topic
platform:#channeldiscord:#opsHuman-friendly channel name (resolved against the channel directory)
platform:+E164signal:+15551234567Phone-addressed platforms: Signal, SMS, WhatsApp

Any platform Hermes ships adapters for works as a target: telegram, discord, slack, signal, sms, whatsapp, matrix, mattermost, feishu, dingtalk, wecom, weixin, email, and others.

Exit Codes

CodeMeaning
0Send (or list) succeeded
1Delivery failed at the platform level (auth, permissions, network)
2Usage / argument / config error

Exit codes follow the standard Unix convention so your scripts can branch on them the same way they would on curl or grep.

---

Message Body Resolution

Commands you type in a terminal. Understand what one does before copying it. Commands here: hermes send.

hermes send resolves the message body in this order:

  1. Positional argument — hermes send --to telegram "hi"
  2. --file PATH — hermes send --to telegram --file msg.txt
  3. Piped stdin — echo hi | hermes send --to telegram

When stdin is a TTY (no pipe), Hermes does not wait for input — you'll get a clear usage error instead. This keeps scripts from hanging if they accidentally omit the body.

---

Real-World Examples

Commands you type in a terminal. Understand what one does before copying it. Commands here: hermes send.

Monitoring: Memory / Disk Alerts

Replace ad-hoc curl https://api.telegram.org/... calls in your watchdogs with a single portable line:

Shell6 lines
#!/usr/bin/env bash
ram_pct=$(free | awk '/^Mem:/ {printf "%d", $3 * 100 / $2}')
if [ "$ram_pct" -ge 85 ]; then
  hermes send --to telegram --subject "⚠ MEMORY WARNING" \
    "RAM ${ram_pct}% on $(hostname)"
fi

Because hermes send reuses your Hermes config, the same script works on any host where Hermes is installed — no need to export bot tokens into each machine's environment manually.

CI / CD: Build and Test Results

Shell8 lines
# In .github/workflows/deploy.yml or any CI script
if ./scripts/deploy.sh; then
  hermes send --to slack:#deploys "✅ ${CI_COMMIT_SHA:0:7} deployed"
else
  tail -n 100 deploy.log | hermes send \
    --to slack:#deploys --subject "❌ deploy failed"
  exit 1
fi

Cron: Daily Report

Shell4 lines
# Crontab entry
0 9 * * * /usr/local/bin/generate-metrics.sh \
  | /home/me/.hermes/bin/hermes send \
      --to telegram --subject "Daily metrics $(date +%Y-%m-%d)"

Long-Running Tasks: Ping When Done

Shell3 lines
./train.py --epochs 200 && \
  hermes send --to telegram "training done" || \
  hermes send --to telegram "training failed (exit $?)"

Scripting with --json and --quiet

Shell9 lines
# Hard-fail a script if delivery fails; don't clutter logs on success
hermes send --to telegram --quiet "keepalive" || {
  echo "Telegram delivery failed" >&2
  exit 1
}

# Capture the message ID for later editing / threading
msg_id=$(hermes send --to discord:#ops --json "build started" \
  | jq -r .message_id)

---

Does `hermes send` Need the Gateway Running?

Commands you type in a terminal. Understand what one does before copying it. Commands here: hermes send, hermes gateway start.

Usually no. For any bot-token platform — Telegram, Discord, Slack, Signal, SMS, WhatsApp Cloud API, and most others — hermes send calls the platform's REST endpoint directly using credentials from ~/.hermes/.env and ~/.hermes/config.yaml. It's a standalone subprocess that exits as soon as the message is delivered.

A live gateway is only required for plugin platforms that rely on a persistent adapter connection (for example, a custom plugin that keeps a long-lived WebSocket open). In that case you'll get a clear error pointing at the gateway; start it with hermes gateway start and retry.

---

Listing and Discovering Targets

Commands you type in a terminal. Understand what one does before copying it. Commands here: hermes send.

Before sending to a specific channel, you can inspect what's available:

Shell8 lines
# Every target across every configured platform
hermes send --list

# Just Telegram targets
hermes send --list telegram

# Machine-readable
hermes send --list --json

The listing is built from ~/.hermes/channel_directory.json, which the gateway refreshes every few minutes while it's running. If you see "no channels discovered yet", start the gateway once (`hermes gateway start`) so it can populate the cache.

Human-friendly names (discord:#ops, slack:#engineering) are resolved against this cache at send time, so you don't need to memorize numeric IDs.

---

Comparison with Other Approaches

Commands you type in a terminal. Understand what one does before copying it. Commands here: hermes send.

ApproachMulti-platformReuses Hermes credsNeeds gatewayBest for
hermes send✅✅No (bot-token)Everything below
Raw curl to each platformEach scripted separatelyManualNoCritical watchdogs
cron job with --deliver✅✅NoScheduled agent tasks

hermes send is intentionally the simplest possible surface. If you need an agent to decide what to say, schedule a cron job — the agent's final response is auto-delivered to the configured deliver: target (the agent no longer fires messages itself). If you need a scheduled run with LLM-generated content, use cronjob(action='create', prompt=...) with deliver='telegram:...'. If you just need to pipe a raw string, reach for hermes send.

---

Knowledge check

2 questions answered by this page alone.

Every option is a real identifier from the Hermes documentation. The wrong ones are real too, just from other pages.

1. In this lesson's table, what is the “Description” for “message (positional)”?
2. Which of these headings does not appear in this lesson?