RoutePath.devRoutePath.to

Webhooks

A webhook sends a JSON POST to your endpoint when something happens to one of your links. Webhooks are set up in your RoutePath.to account settings, not through the API. Pro includes 1 endpoint and Business includes 5.

Events

Headers

Verify the signature

Compute the HMAC of the raw body yourself and compare it to the header before trusting an event.

JavaScript (Node)
import { createHmac, timingSafeEqual } from "node:crypto";

// rawBody is the exact request body string, before any JSON parsing.
export function isValid(rawBody, signatureHeader, secret) {
  const expected = createHmac("sha256", secret).update(rawBody).digest("hex");
  const a = Buffer.from(expected);
  const b = Buffer.from(signatureHeader ?? "");
  return a.length === b.length && timingSafeEqual(a, b);
}

Good practice