2xx response. No polling required.
How webhooks work
- A user votes for your project on Top.gg.
- Top.gg sends an HTTP POST request to your configured webhook URL.
- Your server processes the payload and returns a
2xxresponse within 5 seconds.
Setting up your endpoint
Create an HTTP endpoint
Build an endpoint on your server that accepts
POST requests and reads the raw request body. Your handler must return a 2xx status code to acknowledge each delivery.Enter the webhook URL in your dashboard
Go to your project’s dashboard on Top.gg and navigate to Webhooks. Paste the full URL of your endpoint (for example,
https://your.bot/webhooks/votes).Copy your webhook secret (v1)
After saving, Top.gg generates a webhook secret prefixed with
whs_. Copy this value and store it securely, since you’ll use it to verify incoming requests.Signature verification (v1)
Every v1 webhook request includes anx-topgg-signature header in the format t={unix timestamp},v1={signature}. You must verify this signature before trusting the payload.
Verification steps:
- Capture the raw request body as a string (do not parse it first).
- Parse the
x-topgg-signatureheader to extract the timestamp (t) and signature (v1). - Compute an HMAC SHA-256 digest of
{timestamp}.{rawBody}using your webhook secret as the key. - Compare the computed digest to the
v1value using a constant-time comparison.
x-topgg-trace header containing a trace ID you can use when debugging delivery issues with Top.gg support.
Reliability
Always return a
2xx status code to acknowledge that you received the webhook. Returning any other status causes Top.gg to treat the delivery as failed and schedule a retry.| Property | v1 | v0 legacy |
|---|---|---|
| Timeout | 5 seconds | 5 seconds |
| Max retries | 3 | 10 |
| Retry delay | Exponential backoff: 2^N seconds (≈1s, 2s, 4s) | Exponential backoff: 2^N seconds (1s up to ~17 min) |
| Retry triggers | Timeout or 5xx response | Timeout or 5xx response (4xx are not retried) |