Webhooks for Fentra apps
Rather than asking Fentra over and over whether something changed, subscribe to an event and Fentra sends it to your server, signed.
How delivery works
When you configure your app you'll give a callback URL on HTTPS and choose events. When one happens, Fentra sends a POST with a JSON body and a signature header. Answer with any 2xx within a few seconds; do the work after you've answered. Deliveries that fail are retried, so handle the same event arriving twice.
POST https://app.example.com/hooks/fentra
Content-Type: application/json
Fentra-Signature: t=1793793600,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
{
"event": "authorization.removed",
"client_id": "YOUR_CLIENT_ID",
"open_id": "fo_4c1d9a0e27b8",
"created_at": "2026-11-04T12:00:00Z"
}Verifying a delivery
The signature is an HMAC-SHA256 of the timestamp and the raw body, keyed with your app's webhook secret. Check it, and reject old timestamps, before you trust anything in the body.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(rawBody: string, header: string, secret: string): boolean {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const age = Math.abs(Date.now() / 1000 - Number(parts.t));
if (!parts.t || !parts.v1 || age > 300) return false;
const expected = createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
return timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}Planned events
| Event | When |
|---|---|
authorization.removed | A person removed your app's access. Delete what you stored about them. |
post.published | A video your app put in someone's drafts was posted. |
post.failed | A video your app sent couldn't be processed. |