Public
Verify FastComments webhooks and store events in SQLite
commentsfastcommentssqlitewebhook
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

FastComments webhook receiver

Verifies the HMAC signature on every FastComments webhook delivery and stores what arrives in SQLite.

Live: https://fastcomments-webhooks.val.run

Remix it, hit Send test event, and watch a signed delivery verify and land. Then point a real webhook at your copy.

The contract

FastComments signs ${timestamp}.${body} with your account's API secret and sends:

X-FastComments-Timestamp: 1789004710        unix SECONDS, not millis
X-FastComments-Signature: sha256=<hex>

Methods carry the event: PUT for a created or updated comment, DELETE for a deleted one.

Two things that bite

Verify the raw bytes. verify.ts hashes the exact body string that arrived. Calling c.req.json() and re-serializing changes key order and whitespace, so the hash differs and every delivery fails with no obvious cause. This is the usual reason a webhook receiver "just doesn't work".

Compare in constant time. A plain === on the signature leaks how many bytes matched, which is enough to forge one byte at a time. verify.ts uses timingSafeEqual.

It also rejects deliveries whose timestamp is outside a five minute window, so a captured request cannot be replayed later.

Files

FileWhat it does
config.tsThe API secret, and the replay window
verify.tsSignature verification, and the signer used by the test button
db.tsSQLite storage
main.tsxRoutes
Dashboard.tsxThe event table

Setup

  1. Get your API secret from your account. Free 30 day trial, then plans from $0.99/mo.
  2. Add FASTCOMMENTS_API_SECRET here: https://www.val.town/x/fastcomments/webhook-receiver/environment-variables?key=FASTCOMMENTS_API_SECRET
  3. Add a webhook in your FastComments dashboard pointing at your val's URL.

Unset, the secret falls back to the public demo tenant's, which is what makes the test button work with no setup. The signature check is real, but a secret everyone knows verifies nothing. Set your own before pointing a real webhook here. The dashboard says so while the fallback is in use.

Notes on handling events

Every delivery is stored, retries included. There is deliberately no dedupe key: a comment id repeats across create, edit and delete, and a retry is re-signed with a fresh timestamp, so nothing is stable to dedupe on. Make your handler idempotent on comment_id rather than assuming each event arrives once.

Answer quickly. FastComments retries on a non-2xx, and an endpoint that keeps failing is eventually disabled automatically. Do real work after responding, not inline.

More

val.town/x/fastcomments/skills is a remixable library of FastComments agent skills. Townie and the Val Town MCP server pick them up once the remix is in your account.