Skip to main content
Collaborate at HartSign in

← Back to Help Center

Webhooks

Send signed push, pull request, and issue events to an https endpoint.

  1. 1. Add an endpoint

    On repository Settings, enter an http or https URL, choose events, and add the webhook. The secret is shown once. Organization scope requires an org admin. Failed deliveries stay on that page after three attempts.

  2. 2. Verify the signature

    Each POST sends JSON and the header X-Collaborate-Signature-256. Reject the body when this check returns false. Use the raw body, not a re-serialized object.

    const crypto = require("crypto");
    function verifyWebhook(secret, rawBody, header) {
      const expected = "sha256=" + crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
      const a = Buffer.from(expected);
      const b = Buffer.from(header || "");
      return a.length === b.length && crypto.timingSafeEqual(a, b);
    }