跳到主内容

Webhooks

Webhook 事件推送

在设置 → Webhooks 里添加 URL,平台会以 POST application/json 推送事件。 所有请求带 X-Webhook-Signature 头,使用 HMAC-SHA256 签名你的 secret。

事件清单

事件说明
conversation.created新对话创建
message.completedAI 回复完成(含成本/tokens)
project.published项目发布上线
billing.topup充值到账
billing.low_balance余额低于阈值
alert.triggered健康指标告警触发(Round 28 新增)

签名校验示例(Node)

import { createHmac, timingSafeEqual } from "crypto";

function verify(body: string, sig: string, secret: string) {
  const expected = createHmac("sha256", secret).update(body).digest("hex");
  return sig.length === expected.length &&
    timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
}

重试策略

非 2xx 响应将按 1m / 5m / 30m / 2h / 12h 共 5 次指数退避重试, 全失败后该事件标记为 dead-letter,可在设置 → Webhooks → 失败队列里手动重发。

相关:REST API官方 SDK