Webhooks

Instead of polling, let us call your server when something happens.

curl -X POST https://api.example.com/v1/webhooks -H "Authorization: Bearer $FDS_KEY" -H "Content-Type: application/json" \
  -d '{"url": "https://school.example.com/hooks/feltiv", "events": ["stream.live", "stream.ended", "recording.ready"]}'

The answer contains secret (whsec_...), shown only once. Use it to check that calls really come from us. ["*"] subscribes to all events. HTTPS only; addresses inside private networks are refused.

Events

Event When data
stream.connected Your encoder (or our LiveKit translator) started sending stream_id, protocol
stream.live The first dubbed segments are published (viewers can watch) stream_id
stream.reconnecting The video stopped; we wait reconnect_window_s stream_id
stream.ended The stream is over stream_id, reason, media_seconds
stream.failed It could not continue stream_id, reason, media_seconds
recording.ready The recording and subtitle files are complete stream_id, media_seconds
usage.cap_reached A trial or monthly limit stopped (or refused) a stream stream_id, code, message
webhook.test You called POST /v1/webhooks/{id}/test -

Request we send

POST /hooks/feltiv HTTP/1.1
Content-Type: application/json
Feltiv-Event: stream.ended
Feltiv-Delivery: dlv_9c1e...
Feltiv-Signature: t=1795509300,v1=5d7c0c3b0f...

{"id": "evt_4e8f...", "type": "stream.ended", "created": 1795509300,
 "data": {"stream_id": "str_3bf9...", "reason": "source_disconnected", "media_seconds": 3600.4}}

Answer with any 2xx within 10 seconds. Otherwise we try again after 10 s, 1 min, 5 min, 30 min, 2 h and 6 h, then give up (see GET /v1/webhooks/{id}/deliveries). The same event can arrive more than once: use id to ignore repeats. Redirects are not followed.

Checking the signature

v1 = hex HMAC-SHA256 of "<t>.<raw request body>" with your secret. Also reject t older than 5 minutes.

Python

import hmac, hashlib, time

def valid(secret: str, body: bytes, header: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    if abs(time.time() - int(parts["t"])) > 300:
        return False
    good = hmac.new(secret.encode(), f"{parts['t']}.".encode() + body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(good, parts["v1"])

Node.js

const crypto = require("crypto");
function valid(secret, rawBody, header) {
  const p = Object.fromEntries(header.split(",").map(x => x.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(p.t)) > 300) return false;
  const good = crypto.createHmac("sha256", secret).update(`${p.t}.`).update(rawBody).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(good), Buffer.from(p.v1));
}

Use the raw body bytes (before JSON parsing) when you check.