Skip to content
VaultLens Studio

Webhooks

Webhooks let VaultLens tell your system when something happens (a clone finished, a job failed, an archive run completed) instead of you polling for it. Each event is a signed JSON POST to your endpoint.

Events

Event Sent when data
clone.completed A clone of an app’s tables finished (completed or completed_with_errors). appId, jobId
job.failed A clone, scheduled or manual sync, archive run or restore failed. appId, jobId, jobType (clone, reconcile, archive or restore)
archive.run.completed An archive run finished, test runs included. appId, jobId
schema.changed VaultLens found changes in an app’s Knack schema. appId
sync.unhealthy Live sync errors piled up (reason: "sync_errors"), or the live sync snippet went quiet (reason: "snippet_silent"). appId, reason
ping You clicked Send test in Settings → Webhooks. empty

There’s no event for a sync (reconcile) that succeeds; see run a sync.

Set up an endpoint

Webhooks are managed in the app by workspace owners and admins:

  1. Open Settings → Webhooks and click Add webhook.
  2. Enter the Endpoint URL. It must use https://, be reachable from the internet, and have no username or password in it. Private, internal and localhost addresses are refused, and the address is checked again before each delivery.
  3. Optionally add a Description, tick the Events you want, and click Add webhook.
  4. Copy the signing secret from the Copy your signing secret now dialog. It starts with whsec_ and is shown once. Store it with your endpoint’s configuration.
  5. Click Send test on the webhook to send a ping, then open Deliveries to see how your endpoint answered.

Edit changes the URL, events or on/off state. New signing secret in the edit dialog replaces the secret: the old one stops working at once, so update your endpoint straight away. Deliveries that fail in between are retried and signed with the new secret.

What a delivery looks like

POST /vaultlens/webhook HTTP/1.1
Content-Type: application/json
User-Agent: VaultLens-Webhooks/1.0
VaultLens-Event: archive.run.completed
VaultLens-Delivery: a8Fq2LmZ0pRt7cXv1BnK
VaultLens-Signature: t=1764612000,v1=5c3b1f0e9d8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c

{"id":"evt_Wm9rQ2x1c3Rlcg","type":"archive.run.completed","createdAt":"2026-12-01T18:00:00.000Z","workspaceId":"Wk7dQ2mFz9LpT4xR8bN1","data":{"appId":"6b05a32b031b09796ccc7d52","jobId":"Jb3k2LxQ9"}}
  • id: the event id. It stays the same on retries and resends.
  • type: the event, also sent as VaultLens-Event.
  • createdAt, workspaceId: when the event happened, and the workspace (the workspace.id from GET /me).
  • data: ids only. Payloads never contain record values or message text. Use the ids with the API, for example GET /jobs/<jobId>, to get details.
  • VaultLens-Delivery: the delivery’s id. Retries of one delivery share it; a resend from the delivery log gets a new one.

Verify the signature

Check every delivery before trusting it. The VaultLens-Signature header looks like t=<unix seconds>,v1=<signature>:

  1. Split the header on , and each part on the first = to get t and v1.
  2. Reject the delivery if t is more than 5 minutes (300 seconds) from your clock. This stops old deliveries being replayed.
  3. Compute the HMAC-SHA256 of "<t>.<raw body>" (the t value, a dot, then the request body exactly as received) with your signing secret, as lowercase hex.
  4. Compare it with v1 using a timing-safe comparison.

Use the raw body bytes. If your framework parses JSON first and you re-serialize it, the bytes can differ and the signature won’t match. Each retry is signed again with a new t, so a retried delivery passes the time check.

If the signature is wrong, answer 400 (or any non-2xx). VaultLens will retry, which helps if you’ve just rotated the secret.

curl

curl can’t receive webhooks, but the same check works in a shell script with openssl, for example to test a saved delivery. To compare in constant time, it compares HMACs of both signatures under a random key rather than the signatures themselves.

#!/usr/bin/env bash
# Usage: verify-vaultlens.sh '<VaultLens-Signature header>' body.json
# The signing secret is read from VAULTLENS_WEBHOOK_SECRET. Exits 0 if the delivery is valid.
set -euo pipefail
header="$1"
body_file="$2"

t="" v1=""
IFS=',' read -ra parts <<< "$header"
for part in "${parts[@]}"; do
  part="${part#"${part%%[![:space:]]*}"}"   # trim leading spaces
  case "$part" in
    t=*) t="${part#t=}" ;;
    v1=*) v1="${part#v1=}" ;;
  esac
done
case "$t" in ''|*[!0-9]*) echo "bad header" >&2; exit 1 ;; esac
[ -n "$v1" ] || { echo "bad header" >&2; exit 1; }

age=$(( $(date +%s) - t ))
if [ "${age#-}" -gt 300 ]; then echo "too old" >&2; exit 1; fi

hmac_hex() { openssl dgst -sha256 -hmac "$1" | sed 's/^.*= //'; }
expected=$( { printf '%s.' "$t"; cat "$body_file"; } | hmac_hex "$VAULTLENS_WEBHOOK_SECRET")

# Timing-safe comparison: HMAC both values with a one-off random key, then compare.
k=$(openssl rand -hex 32)
if [ "$(printf '%s' "$expected" | hmac_hex "$k")" = "$(printf '%s' "$v1" | hmac_hex "$k")" ]; then
  echo "valid"
else
  echo "bad signature" >&2; exit 1
fi

To try your endpoint locally with a correctly signed request, sign a body yourself and send it with curl:

body='{"id":"evt_test","type":"ping","createdAt":"2026-12-01T18:00:00.000Z","workspaceId":"Wk7dQ2mFz9LpT4xR8bN1","data":{}}'
t=$(date +%s)
sig=$(printf '%s.%s' "$t" "$body" | openssl dgst -sha256 -hmac "$VAULTLENS_WEBHOOK_SECRET" | sed 's/^.*= //')
curl -i https://localhost:8443/vaultlens/webhook \
  -H "Content-Type: application/json" \
  -H "VaultLens-Event: ping" \
  -H "VaultLens-Delivery: test-delivery" \
  -H "VaultLens-Signature: t=$t,v1=$sig" \
  --data-binary "$body"

Node

// Node 18+. A webhook receiver on node:http that verifies VaultLens-Signature.
import { createHmac, timingSafeEqual } from 'node:crypto';
import { createServer } from 'node:http';

const TOLERANCE_SECONDS = 300;

/** rawBody: the request body as received (Buffer or string). */
export function verifyVaultLensSignature(rawBody, header, secret, nowMs = Date.now()) {
  if (typeof header !== 'string') return false;
  const parts = {};
  for (const item of header.split(',')) {
    const i = item.indexOf('=');
    if (i > 0) parts[item.slice(0, i).trim()] = item.slice(i + 1).trim();
  }
  if (!/^\d+$/.test(parts.t ?? '') || !parts.v1) return false;
  if (Math.abs(nowMs / 1000 - Number(parts.t)) > TOLERANCE_SECONDS) return false;
  const expected = createHmac('sha256', secret).update(`${parts.t}.`).update(rawBody).digest();
  const given = Buffer.from(parts.v1, 'hex');
  return given.length === expected.length && timingSafeEqual(given, expected);
}

const seen = new Set(); // use a database or cache with a TTL in production

createServer((req, res) => {
  const chunks = [];
  req.on('data', (c) => chunks.push(c));
  req.on('end', () => {
    const raw = Buffer.concat(chunks);
    const ok = verifyVaultLensSignature(
      raw,
      req.headers['vaultlens-signature'],
      process.env.VAULTLENS_WEBHOOK_SECRET,
    );
    if (!ok) {
      res.writeHead(400).end();
      return;
    }
    const event = JSON.parse(raw.toString('utf8'));
    res.writeHead(204).end(); // answer quickly, then do the work
    if (seen.has(event.id)) return; // a retry or resend
    seen.add(event.id);
    console.log(event.type, event.data);
  });
}).listen(8080);

Python

# A webhook receiver using only the standard library. With Flask, pass
# request.get_data() and request.headers.get("VaultLens-Signature") to the same function.
import hashlib
import hmac
import json
import os
import time
from http.server import BaseHTTPRequestHandler, HTTPServer

TOLERANCE_SECONDS = 300


def verify_vaultlens_signature(raw_body: bytes, header: str, secret: str, now: float = None) -> bool:
    if not header:
        return False
    parts = {}
    for item in header.split(","):
        key, sep, value = item.strip().partition("=")
        if sep:
            parts[key] = value
    t, v1 = parts.get("t", ""), parts.get("v1", "")
    if not t.isdigit() or not v1:
        return False
    now = time.time() if now is None else now
    if abs(now - int(t)) > TOLERANCE_SECONDS:
        return False
    expected = hmac.new(secret.encode(), t.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected.encode(), v1.encode())


seen = set()  # use a database or cache with a TTL in production


class Handler(BaseHTTPRequestHandler):
    def do_POST(self):
        raw = self.rfile.read(int(self.headers.get("Content-Length", 0)))
        secret = os.environ["VAULTLENS_WEBHOOK_SECRET"]
        if not verify_vaultlens_signature(raw, self.headers.get("VaultLens-Signature"), secret):
            self.send_response(400)
            self.end_headers()
            return
        event = json.loads(raw)
        self.send_response(204)  # answer quickly, then do the work
        self.end_headers()
        if event["id"] in seen:  # a retry or resend
            return
        seen.add(event["id"])
        print(event["type"], event["data"])


if __name__ == "__main__":
    HTTPServer(("", 8080), Handler).serve_forever()

Retries and duplicates

Answer with any 2xx status within 10 seconds. Anything else counts as a failure: another status, a timeout, a connection error, or a redirect (redirects aren’t followed).

  • Failed deliveries are retried with exponential backoff, starting about a minute after the first attempt and doubling each time, for up to 8 attempts in all. The last attempt comes roughly two hours after the first. After that the delivery is marked failed.
  • Settings → Webhooks → Deliveries lists the last 50 deliveries from the past 30 days, with each one’s status (pending, retrying, delivered or failed), attempts, last status code and error. Resend sends a delivery again.
  • Turning a webhook off stops its pending deliveries (they’re marked failed). Test pings are still sent.

Because of retries and resends, your endpoint can receive the same event more than once. Deliveries can also arrive out of order. To handle both:

  • Store the event id and skip events you’ve already processed.
  • Answer 2xx as soon as the signature checks out, and do slow work afterwards (for example from a queue), so you stay inside the 10 seconds.
  • Treat the event as a prompt to look things up, not as the full state: fetch the job or app from the API to see where it is now. Use createdAt if you need to order events.

The event schemas are also listed under Webhooks in the API reference.