ntfy: 用 HTTP 请求给手机发推送

ntfy 是什么 ntfy(读作 notify)是一个开源的发布/订阅推送服务。脚本用一个普通的 HTTP PUT/POST 把消息发到某个 topic,订阅了这个 topic 的手机 App、浏览器或其他脚本就会收到通知。 不需要注册账号,topic 第一次被用到时自动创建 服务端是一个 Go 程序,可以用官方的 ntfy.sh,也可以自己部署 客户端:Android(Google Play / F-Droid)、iOS(App Store)、网页(Web Push),都是开源的 典型用途是让无人值守的脚本在出结果时通知人:备份完成、CI 失败、定时任务出错、AI agent 跑完一个任务。 最简单的用法 手机装好 App,订阅一个 topic,比如 wiloon-enx-agent-7f3k9q,然后: # Plain message curl -d "Backup finished" ntfy.sh/wiloon-enx-agent-7f3k9q # Title, priority, tags (emoji shortcodes) and a link opened on tap curl \ -H "Title: enx-agent: #51 merged" \ -H "Priority: default" \ -H "Tags: white_check_mark" \ -H "Click: https://github.com/wiloon/enx/pull/203" \ -d "PR #203 merged, issue #51 closed" \ ntfy.sh/wiloon-enx-agent-7f3k9q 常用的请求头: ...

Created 17176-10-17 · Updated 17176-10-17 · 2 min · 406 words · -