ZH

语言

登录免费开始
Developers: API, webhooks, MCP and integrations · 2/5

Receiving events with webhooks and verifying signatures

Send deal, payment and other events to your server instantly; verify the signature and de-duplicate retries.

14 分钟 · 适用对象: 全部

课程内容以英文显示;界面使用你的语言。
位置

Dashboard → All tools → Management → Developers → Webhooks

打开页面

学完本课后

You can set up a webhook endpoint, send a test event, verify with the signature that a request really came from Reydoc and know the retry rules on failure.

A webhook is Reydoc sending an HTTPS POST to your server when something happens (for example a deal is funded or a payment is made), so you do not have to poll the API.

Delivery is "at least once": with network issues the same event can arrive more than once, so de-duplicate every event by its event ID.

分步说明

  1. Create an endpoint

    In the Webhooks tab choose the environment in the new endpoint form. As the target choose your own HTTPS address, or the Reydoc test receiver (7 days) to experiment.

  2. Enter the address and events

    Enter your server address (up to 500 characters). Choose "*" for all events, group options such as "deal.*", or only webhook.test.v1 to try it. Groups: campaign, deal, payment, payout, order, affiliate, creator, social, media, rights, agency, team, automation, integration, store.

  3. Store the secret

    Add an optional description (up to 200 characters) and create the endpoint. The signing secret is shown only once; put it in your server's secret variables.

  4. Verify the signature

    Each request carries a "Reydoc-Signature: t=<unix seconds>,v1=<hex>" header. On your server compute HMAC-SHA256(secret, t + "." + raw body) and compare it with v1 in constant time. Reject the request if t is more than 300 seconds old (replay protection).

  5. Send a test event

    On the endpoint page send a test event. With the test receiver you see whether the signature is valid and the clock difference. On your own server check that you return 2xx.

  6. Manage the endpoint

    The endpoint page has Resend (repeats a single delivery), Rotate secret (the old secret stops working immediately), Pause, Activate and Close.

规则与限制

  • Up to 10 open endpoints per workspace; the delivery timeout is 10 seconds.
  • Failed deliveries are retried after 1 min, 5 min, 30 min, 2 h, 8 h and 24 h. After the 7th attempt, the delivery goes to the dead-letter queue (DLQ).
  • An endpoint with 15 consecutive failures is closed automatically and its owner is emailed.
  • The endpoint address must be https.

小贴士

  • Return 2xx as soon as you receive the event and queue the heavy work; if you exceed 10 seconds the delivery counts as failed.
  • Store processed event IDs in a table; ignore an ID that arrives again.
  • After rotating the secret, update the value on your server at the same time; the old secret stops working immediately.

常见错误

  • Computing the signature over parsed JSON: the signature covers the raw body, and even a whitespace change breaks it.
  • Skipping the timestamp check: you stay open to replays of old requests.
  • Processing the same event twice (for example reducing stock twice): no de-duplication.
你的进度只保存在此浏览器中。

相关课程

Receiving events with webhooks and verifying signatures · Reydoc Academy