接收测试通知
下面的接口说明为英文原文。
Signed per the Standard Webhooks specification. Verify with an official Standard Webhooks library and the endpoint's whsec_ signing secret: it checks Base64(HMAC-SHA256(Base64-decoded secret, webhook-id + '.' + webhook-timestamp + '.' + raw_body)) against each v1 entry in webhook-signature in constant time and rejects timestamps more than five minutes from now. Deduplicate by webhook-id. Redelivery preserves the body and webhook-id and signs again with a new timestamp.
VizoAPI 会把这个请求发送到你在控制台创建的 Webhook 端点。
请求头
| 字段 | 说明 |
|---|---|
| webhook-idstring必填 | Unique event ID, equal to event_id in the body. Unchanged on retries and redelivery; use it to deduplicate. |
| webhook-timestampstring必填 | Unix time in seconds when this attempt was sent. |
| webhook-signaturestring必填 | Space-delimited list of v1 signatures. Two are sent for 24 hours after a secret rotation; accept the request if any one matches. |
请求体
JSON 对象,不接受未列出的字段。
| 字段 | 说明 |
|---|---|
| created_atdate-time必填 | |
| event_idstring必填 | |
| testboolean必填 | |
| typestring必填 | webhook.test |
响应
2XX Delivery accepted
请求示例
cURL
# Your endpoint receives a POST signed per Standard Webhooks. Replay one locally to test your handler:
curl -X POST "$YOUR_WEBHOOK_URL" \
-H "Content-Type: application/json" \
-H "webhook-id: $EVENT_ID" \
-H "webhook-timestamp: $TIMESTAMP" \
-H "webhook-signature: v1,$SIGNATURE" \
--data-binary @event.jsonPython
# pip install standardwebhooks
from standardwebhooks import Webhook, WebhookVerificationError
wh = Webhook("whsec_...") # your endpoint's signing secret
def verify(headers, raw_body: bytes):
try:
return wh.verify(raw_body, headers) # returns the parsed event
except WebhookVerificationError:
return NoneNode.js
// npm install standardwebhooks
import { Webhook } from "standardwebhooks";
const wh = new Webhook(process.env.WEBHOOK_SECRET); // whsec_...
// rawBody is a Buffer of the request body as received, e.g. express.raw({ type: "application/json" }).
export function verify(headers, rawBody) {
try {
return wh.verify(rawBody, headers); // returns the parsed event
} catch {
return null;
}
}{
"created_at": "2026-11-02T08:01:43Z",
"event_id": "string",
"test": false,
"type": "webhook.test"
}