formrhythmDocs

Webhooks

Send every new submission to your own API or automation tool, signed so you can verify it.

On the Pro plan, FormRhythm can POST every new submission to a URL you control.

Turn on webhooks

In the form's Form settings:

  1. Turn on Webhook delivery.
  2. Enter the Webhook URL. It must be public and accept POST requests.
  3. Set a Webhook secret so you can check that requests really come from FormRhythm.

The request

HeaderValue
Content-Typeapplication/json
User-AgentFormRhythm-Webhooks/1.0
X-FormRhythm-Eventsubmitted
X-FormRhythm-SignatureHex HMAC SHA-256 of the raw body, using your webhook secret. Only sent when a secret is set.
Body
{
  "event": "submitted",
  "form": {
    "id": "cmh2x7k9q0001",
    "name": "Contact form"
  },
  "submission": {
    "id": "cmh2y1p3d0004",
    "createdAt": "2026-10-26T14:03:12.481Z",
    "data": {
      "name": "Maya Chen",
      "email": "maya@example.com",
      "message": "I would love to learn more about your product."
    },
    "files": [
      {
        "id": "cmh2y1p3e0005",
        "fieldName": "resume",
        "fileName": "maya-chen.pdf",
        "contentType": "application/pdf",
        "size": 184320
      }
    ]
  }
}

Verify the signature

Compute an HMAC SHA-256 of the raw request body with your secret, and compare it to the X-FormRhythm-Signature header using a constant-time comparison. Verify before parsing the JSON, because re-serialising it can change the bytes.

app/api/formrhythm/route.ts
import crypto from 'node:crypto';

export async function POST(request: Request) {
  // Verify against the raw body, before parsing it.
  const body = await request.text();
  const received = request.headers.get('x-formrhythm-signature') ?? '';
  const expected = crypto
    .createHmac('sha256', process.env.FORMRHYTHM_WEBHOOK_SECRET!)
    .update(body)
    .digest('hex');

  const valid =
    received.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));

  if (!valid) {
    return new Response('Invalid signature', { status: 401 });
  }

  const event = JSON.parse(body);
  // event.submission.data holds the submitted fields.

  return new Response(null, { status: 204 });
}

Delivery

Webhooks are sent once, while the visitor's submission is being processed, and are not retried. Respond quickly with a 2xx status and do slow work in the background. If delivery fails, the submission is still saved in your dashboard.

On this page