ᚱDisrune

How to set up a vote webhook

Get a Discord channel message or data on your own API after every vote.

Discord webhook

  1. In Discord, open Edit Channel → Integrations → Webhooks and create a new webhook.
  2. Copy its URL.
  3. On Disrune, open Manage servers and click Vote webhook on an approved server.
  4. Paste the URL and optionally write your own message.
  5. Click Send test, then Save webhook.

Message variables

{user} · {username} · {server} · {votes} · {month} · {link}

The text can be up to 500 characters. Messages never ping anyone.

Your own API

In the Vote webhook window, switch to Your API and enter your address. It must be public and use HTTPS on port 443. The signing key appears only after saving and only for your own API, as Discord webhooks don't use one. Keep it safe. Your API must respond with a 2xx status within 5 seconds. Redirects are not followed and failed deliveries are not retried.

Request body

After each vote we send a POST with this JSON. Test messages use the event vote.test, so don't give rewards for them.

{
  "event": "vote",
  "voted_at": "2026-11-09T22:00:00.000Z",
  "user": { "id": "123456789012345678", "username": "Example" },
  "server": {
    "id": "987654321098765432",
    "name": "My server",
    "slug": "my-server",
    "url": "https://disrune.com/server/my-server"
  },
  "votes": { "total": 42, "month": 7 }
}

Verifying the signature

Every request has the X-Disrune-Timestamp and X-Disrune-Signature headers. The signature is HMAC-SHA256 of timestamp.body. Always check it against the unmodified request body.

import crypto from "node:crypto";

// rawBody = the unmodified request body as a string
export function isFromDisrune(rawBody, headers, secret) {
  const timestamp = String(headers["x-disrune-timestamp"]);
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;

  const expected = Buffer.from(
    "sha256=" + crypto.createHmac("sha256", secret).update(timestamp + "." + rawBody).digest("hex")
  );
  const received = Buffer.from(String(headers["x-disrune-signature"]));
  return expected.length === received.length && crypto.timingSafeEqual(expected, received);
}