-
Notifications
You must be signed in to change notification settings - Fork 0
Setup notification
wumingshi edited this page Dec 7, 2024
·
2 revisions
目前,UptimeFlare 使用 Apprise 发送通知,支持 100 多种通知渠道。
然而,Apprise 库是用 Python 编写的,而 Cloudflare 最近发布的 Python Worker 在部署 Apprise 时仍存在问题。因此,我们目前使用 Vercel 的无服务器部署,此部分可能在未来会有所变化。你也可以自行部署 Apprise API。
-
部署完成后,你将获得一个类似
https://testapprise-lyc8503s-projects.vercel.app/的链接,在其后添加/notify,即为 Apprise API 服务器链接:
https://testapprise-lyc8503s-projects.vercel.app/notify -
根据 Apprise 的 wiki 文档 编写用于发送通知的 URL。文档中详细说明了如何设置每种通知渠道。
例如,对于 Telegram,你的 URL 格式为:tgram://botToken/chatId -
在
workerConfig.notification配置中填写如下内容:
notification: {
appriseApiServer: "https://testapprise-lyc8503s-projects.vercel.app/notify",
recipientUrl: "tgram://botToken/chatId",
// [可选] 通知消息中使用的时区,默认值为 "Etc/GMT"
timeZone: "Asia/Shanghai",
// [可选] 在发送通知前的宽限期(以分钟为单位)
// 仅当监控在初次失败后连续 N 次检查都失败时,才会发送通知
// 如果未指定,则会立即发送通知
gracePeriod: 5,
},如果你熟悉 JavaScript 语言,可以在 workerConfig.callbacks 中使用 fetch API 自行请求所需的 Webhook,而无需部署 Apprise 服务。
警告:在回调中长时间阻塞可能会导致整个监控功能异常。如果你不知道如何调试这种情况,请不要修改回调,建议使用上述 Apprise 方法。