Guide
Webhooks
Instead of polling, register an HTTPS endpoint and Comflyant will POST an event to it as things happen — a new form sent, a form completed.
Register an endpoint
Create a webhook endpoint with POST /v1/webhooks, giving the URL
to call and the list of event types you want. The response includes a
signing secret, shown once — store it; you'll use it to verify
deliveries. You can update the URL or event subscription, rotate the secret, and
inspect recent delivery attempts, all under /v1/webhooks (see the
reference).
Event catalog
The full list of events and the exact payload shape for each is published in the API reference, under “Webhooks”. That catalog is generated from the server — it's the same source of truth the code emits from, checked by a drift test in CI — so it always matches what you'll actually receive. Today Comflyant emits:
form.created- A new form instance was created and its link sent to the recipient (via a schedule or an ad-hoc send). Not yet answered.
form.completed-
A recipient completed a form (all required questions answered). If the
template has scoring enabled, the payload carries the computed
scoreandscore_status— see scoring.
Rather than copy field lists here (they'd go stale), open the reference for the authoritative payload schema.
The delivery
Each delivery is a JSON POST with this envelope:
POST https://your-endpoint.example/comflyant
Content-Type: application/json
X-Comflyant-Event: form.completed
X-Comflyant-Delivery: 7b1e... (unique per attempt)
X-Comflyant-Signature: sha256=<hex>
{
"id": "7b1e...", // this delivery's id
"event": "form.completed",
"created_at": "2026-10-22T10:15:00Z",
"data": { ...event payload... }
}
Verify the signature
Before trusting a delivery, verify the X-Comflyant-Signature header.
It is sha256= followed by the hex HMAC-SHA256 of the
raw request body, keyed with your endpoint's signing secret.
Compute the same HMAC and compare in constant time:
import hashlib, hmac
def verify(secret: str, raw_body: bytes, header: str) -> bool:
expected = "sha256=" + hmac.new(
secret.encode(), raw_body, hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, header)
Sign over the exact bytes you received, before any JSON re-serialisation — re-encoding can change the body and break the match. Reject anything that doesn't verify.
Responses & retries
Respond with any 2xx status to acknowledge. A non-2xx response or a
timeout is retried with exponential backoff (up to five attempts over several
hours); after that the delivery is marked failed. Your handler should be
idempotent — use the delivery id to de-duplicate, since
a retry can arrive after your endpoint already processed one.