用途:该技能通过 pocketalert 命令行工具与 Pocket Alert 服务交互,用于发送推送通知,并管理应用、设备、Webhook 和 API 密钥等资源。
前置条件:需先安装并认证 pocketalert CLI。安装方式为从 https://info.pocketalert.app/cli.html 下载并解压到 /usr/local/bin/;认证命令为 pocketalert auth <your-api-key>。
主要能力: 发送推送通知:可用 pocketalert send -t "Title" -m "Message" 发送基础通知;或用完整形式 pocketalert messages send --title "Alert" --message "Server is down!"。可指定应用(-a <app-tid>)、指定设备(-d <device-tid>)或发送到所有设备(-d all)。 列表查询:messages list(支持 --limit、--device)、apps list、devices list、webhooks list、apikeys list。 应用管理:apps create(--name、可选 -c 颜色)、apps get、apps delete。 设备管理:devices list、devices get、devices delete。 Webhook 管理:webhooks create(--name、--message,可加 -a 应用、-d 设备)、webhooks list、webhooks get、webhooks delete。创建 Webhook 时消息模板可使用来自传入负载的变量,例如 %repository.name%、%head_commit.message%、%sender.login%。 API 密钥管理:apikeys create --name、apikeys list、apikeys delete。 配置:pocketalert config 查看配置,pocketalert config set api_key <new-api-key> 设置密钥,pocketalert config set base_url https://your-api.example.com 设置自定义基址(用于自托管)。配置存储于 ~/.pocketalert/config.json。
适用场景:可集成到 CI/CD,如 GitHub Actions / GitLab CI 中发送构建完成通知;可通过 cron 做服务器监控推送;也可在服务检查脚本中(如 nginx 未运行时)发送告警。
限制与错误处理:CLI 返回退出码,0 表示成功,1 表示认证或 API 错误,2 表示参数无效,应始终检查命令输出以获取错误详情。其余收费、价格、平台支持等资料暂未提供。