ntfy-notify
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesentfy Notify
ntfy 通知
Use for deterministic, low-overhead notifications.
scripts/ntfy_send.sh使用实现确定性、低开销的通知。
scripts/ntfy_send.shPrerequisites
前提条件
- Required default topic:
NTFY_DEFAULT_TOPIC- Example:
export NTFY_DEFAULT_TOPIC="my-topic"
- Example:
- Optional auth: (script also accepts legacy
NTFY_ACCESS_TOKEN)NTFY_TOKEN- Example:
export NTFY_ACCESS_TOKEN="<your-ntfy-access-token>"
- Example:
- Secrets/defaults file:
~/.config/stu-skills/ntfy-notify/.env- The script reads this path from automatically.
ntfy-notify/.env-path
- The script reads this path from
- If is missing and
NTFY_DEFAULT_TOPICis not passed, the script exits with an instruction for the agent to ask the user for it.--topic
- 必填默认主题:
NTFY_DEFAULT_TOPIC- 示例:
export NTFY_DEFAULT_TOPIC="my-topic"
- 示例:
- 可选认证:(脚本也兼容旧版
NTFY_ACCESS_TOKEN)NTFY_TOKEN- 示例:
export NTFY_ACCESS_TOKEN="<your-ntfy-access-token>"
- 示例:
- 密钥/默认值文件:
~/.config/stu-skills/ntfy-notify/.env- 脚本会自动从读取该路径。
ntfy-notify/.env-path
- 脚本会自动从
- 如果缺少且未传入
NTFY_DEFAULT_TOPIC参数,脚本将退出并提示Agent向用户询问主题。--topic
Configure
配置步骤
- Set a default topic:
export NTFY_DEFAULT_TOPIC="my-topic"
- Optionally set token auth:
export NTFY_ACCESS_TOKEN="<your-ntfy-access-token>"
- Optional custom server (default is ):
https://ntfy.shexport NTFY_SERVER="https://ntfy.sh"
- Recommended: store values in so the agent only executes the script and does not need secret values inline.
~/.config/stu-skills/ntfy-notify/.env- Example:
NTFY_DEFAULT_TOPIC="my-topic"NTFY_ACCESS_TOKEN="<your-ntfy-access-token>"NTFY_SERVER="https://ntfy.sh"
- Example:
- 设置默认主题:
export NTFY_DEFAULT_TOPIC="my-topic"
- 可选:设置令牌认证:
export NTFY_ACCESS_TOKEN="<your-ntfy-access-token>"
- 可选:自定义服务器(默认是):
https://ntfy.shexport NTFY_SERVER="https://ntfy.sh"
- 推荐:将值存储在中,这样Agent只需执行脚本,无需在代码中直接写入密钥值。
~/.config/stu-skills/ntfy-notify/.env- 示例:
NTFY_DEFAULT_TOPIC="my-topic"NTFY_ACCESS_TOKEN="<your-ntfy-access-token>"NTFY_SERVER="https://ntfy.sh"
- 示例:
.env Sample
.env 示例
Path:
~/.config/stu-skills/ntfy-notify/.envdotenv
NTFY_DEFAULT_TOPIC="my-topic"
NTFY_ACCESS_TOKEN="<your-ntfy-access-token>"
NTFY_SERVER="https://ntfy.sh"路径:
~/.config/stu-skills/ntfy-notify/.envdotenv
NTFY_DEFAULT_TOPIC="my-topic"
NTFY_ACCESS_TOKEN="<your-ntfy-access-token>"
NTFY_SERVER="https://ntfy.sh"Send
发送通知
- Basic:
scripts/ntfy_send.sh "Build finished"
- Explicit topic:
scripts/ntfy_send.sh --topic ops-alerts "Backup completed"
- Add title/priority/tags:
scripts/ntfy_send.sh --title "Deploy" --priority 4 --tags rocket,white_check_mark "Release shipped"
- 基础用法:
scripts/ntfy_send.sh "Build finished"
- 指定主题:
scripts/ntfy_send.sh --topic ops-alerts "Backup completed"
- 添加标题/优先级/标签:
scripts/ntfy_send.sh --title "Deploy" --priority 4 --tags rocket,white_check_mark "Release shipped"
Notes
注意事项
- Prefer env vars for secrets and defaults.
- redacts bearer token values in printed curl output.
--dry-run - Keep messages short and actionable.
- Use to verify payload/header behavior without network calls.
--dry-run
- 优先使用环境变量存储密钥和默认值。
- 参数会在打印的curl输出中隐藏Bearer令牌值。
--dry-run - 保持消息简短且具有可操作性。
- 使用参数可在不发起网络请求的情况下验证负载/头信息的行为。
--dry-run