欢迎所有爱好区块链技术的人加入。

ARCHIVES / 2502.HTML

ntfy 推送通知工具指南

Surou Other-新手教程

ntfy 推送通知工具指南

一、工具简介

ntfy 是一款开源的 HTTP 推送通知服务,使用 Go 编写,单二进制发布,采用 Apache-2.0 协议。

核心目标: 解决脚本、训练、爬虫等长时间任务完成后,无法及时获知结果的问题。

核心特点:


二、基础用法示例

发送简单文本通知

curl -d "备份完成了" ntfy.sh/mytopic-secret123

带标题、优先级、标签的通知

curl -H "Title: 构建失败" \
     -H "Priority: urgent" \
     -H "Tags: warning,skull" \
     -d "第 3 步测试挂了" \
     ntfy.sh/mytopic-secret123

推送文件(如日志、截图)

curl -T error.log \
     -H "Filename: error.log" \
     ntfy.sh/mytopic-secret123

三、适用人群与注意事项

推荐使用

谨慎使用

重要提醒


四、快速上手步骤

方式一:零安装体验(5 分钟)

  1. 构思一个复杂难猜的 Topic 名称

  2. 终端执行:

    curl -d "hello from terminal" ntfy.sh/你的topic名
    
  3. 手机安装 ntfy App 并订阅相同 Topic

方式二:完整体验(20–30 分钟)

  1. Android: Google Play / F-Droid 搜索 ntfy
  2. iOS: App Store 搜索 ntfy
  3. 打开 App → 订阅 → 输入 Topic 名称

方式三:自托管(可选)

适合对数据隐私有要求的用户:

docker run -p 80:80 -it binwiederhier/ntfy serve

详细文档:https://docs.ntfy.sh/install/


五、项目信息

项目字段 内容
项目名称 ntfy
GitHub https://github.com/binwiederhier/ntfy
官网 https://ntfy.sh
Star 数 ~3.2 万(截至 2026-07-14)
开源协议 Apache-2.0

六、一句话评价

ntfy 将「被通知」从 IM 中解耦,封装成可编程的 HTTP 接口,是自动化工具链中极其轻量、实用的一块拼图。