Notify Hub

API Documentation

当前域名首页提供服务状态说明与接口文档,便于在浏览器中直接查看。

Notify Hub 接入 API

只看两个入口就够了:

这两个接口当前都不需要 Authorization token。

1. 推送消息

请求头


Content-Type: application/json

最小请求体


{

  "title": "新的重点提醒",

  "body": "这是一条来自外部服务的通知。",

  "sourceName": "Studio"

}

完整请求体


{

  "title": "票务监测发现新的结果",

  "body": "目标票档已锁定,请立即完成后续处理。",

  "sourceName": "Ticket Worker",

  "level": "critical",

  "targetUsernames": ["zhubin"]

}

参数说明

成功响应示例


{

  "requestId": "6f5a95d6-7b76-4a92-b4ef-f9d02073d991",

  "success": true,

  "status": "success",

  "createdAt": "2026-03-20T14:10:11.000Z",

  "sourceName": "Ticket Worker",

  "targetUsernames": ["zhubin"],

  "requestedCount": 1,

  "createdCount": 1,

  "deliveredCount": 1,

  "failedCount": 0,

  "skippedCount": 0,

  "invalidTokens": [],

  "notificationIds": ["94f41756-8bd5-43e3-9f34-467a15815a56"],

  "deliveryDetails": [

    {

      "notificationId": "94f41756-8bd5-43e3-9f34-467a15815a56",

      "userId": "admin-user-id",

      "username": "zhubin",

      "tokenCount": 1,

      "deliveredCount": 1,

      "failedCount": 0,

      "skipped": false,

      "reason": "delivered",

      "invalidTokens": [],

      "tokenResults": []

    }

  ]

}

deliveryDetails.reason 会说明本次为什么投递成功、跳过或失败,重点看:

curl 示例


curl -X POST https://notify.zbcode.cn/api/notifications/webhook \

  -H "Content-Type: application/json" \

  -d '{

    "title": "新的重点提醒",

    "body": "这是一条来自外部服务的通知。",

    "sourceName": "Studio",

    "level": "important",

    "targetUsernames": ["zhubin"]

  }'

2. 创建 Todo

请求头


Content-Type: application/json

最小请求体


{

  "title": "补齐 Android Todo 文档",

  "content": "需要补充字段说明、curl 示例和返回结构。",

  "source": "Task Loader"

}

完整请求体


{

  "title": "补齐 Android Todo 文档",

  "content": "需要补充字段说明、curl 示例和返回结构。",

  "source": "Task Loader",

  "priority": "high",

  "dueAt": "2026-03-23T09:30:00+08:00",

  "targetUsername": "zhubin",

  "projectName": "产品研发",

  "collectionName": "Android Todo 接入"

}

参数说明

路由规则

成功响应示例


{

  "success": true,

  "task": {

    "id": "ed1f1f06-5720-4672-bef4-e2b94a37e750",

    "userId": "admin-user-id",

    "projectId": "1f0f0e37-6325-4f4f-9f56-48b1b7bbd88c",

    "collectionId": "120984a4-6d13-4187-96d6-f54b8e192b40",

    "title": "补齐 Android Todo 文档",

    "content": "需要补充字段说明、curl 示例和返回结构。",

    "sourceType": "webhook",

    "sourceName": "Task Loader",

    "priority": "high",

    "dueAt": "2026-03-23T01:30:00.000Z",

    "status": "todo",

    "createdAt": "2026-03-21T10:31:22.000Z",

    "updatedAt": "2026-03-21T10:31:22.000Z",

    "completedAt": null,

    "sourceNotificationId": null

  }

}

curl 示例


curl -X POST https://notify.zbcode.cn/api/webhooks/tasks \

  -H "Content-Type: application/json" \

  -d '{

    "title": "补齐 webhook 接入文档",

    "content": "需要增加字段说明和最小示例。",

    "source": "Task Loader",

    "priority": "high",

    "dueAt": "2026-03-23T09:30:00+08:00",

    "targetUsername": "zhubin",

    "projectName": "产品研发",

    "collectionName": "Android Todo 接入"

  }'

说明