Register a webhook for domain verification outcomes, then keep a scheduled sweep of pending domains. That combination gives an edtech onboarding service a prompt completion signal and a recovery path when its own receiver is unavailable. Verify the signature before changing ownership state. Only then should a completion event make a school's domain eligible for the next onboarding action.
TL;DR: Use webhooks for prompt notification, polling for recovery, and pending age to decide when an operator should investigate. Neither path should turn unfinished verification into permission to cut over.
Imagine moving school-owned zones off a registrar-specific API while teachers are waiting to finish onboarding. The tempting dashboard number is how quickly the migration script finishes. The useful number is how long each school remains pending. A fast write doesn't establish completed verification, and an event timestamp alone doesn't explain whether a school can proceed. Keep those observations separate.
1. Define the cutover gate before moving a zone
Before: registrar request, pending screen, repeated checks, eventual notification. After: verification request, signed completion signal, state transition, notification; a scheduled sweep feeds the same transition when the signal was missed. That's the diagram in words. The two evidence paths meet at one decision.
Start with three application-owned fields: a tenant identifier, a domain, and the time verification began. Store the verification state alongside them. These are your ledger fields, not a proposed provider response schema. A school becomes eligible for the next step only after accepted verification evidence moves that ledger entry from pending to verified. Completion of the registrar migration request is a separate observation.
Measure pending age.
A useful log entry records the tenant, domain, evidence source, prior state, next state, and elapsed pending time. Aggregate the number still pending and the age of the oldest entry. A webhook completion count helps explain traffic, but a quiet receiver could mean there was nothing to finish or that your application missed events. The ledger gives the sweep something concrete to reconcile.
For the example below, a five-minute investigation threshold is an application policy chosen for demonstration. It isn't a propagation estimate or a provider commitment. A school above that threshold gets attention; it doesn't get automatically approved. Actual cutover timing must follow accepted verification evidence, even if a release window is closing.
2. Run the transition before connecting a provider
Save this as verification.mts and run it with a TypeScript-capable Node.js runtime using node verification.mts. It needs no packages. Use a runtime with native TypeScript type stripping enabled. To run the optional, read-only contract preflight, set INFRAI_ORIGIN to the service's configured HTTPS API origin and INFRAI_API_KEY to your credential. The preflight retrieves discovery metadata; it does not verify a school domain. The signing secret, event envelope, and successful sweep result below are local test fixtures; they don't describe a vendor's webhook protocol.
The program walks through three checks. First, reject a completion with an invalid signature. Next, accept the signed completion once. Finally, reconcile a second school through the sweep. The assertions are the decision criteria, so a broken transition stops the program rather than leaving a plausible-looking dashboard. The first section's gate becomes executable here: an invalid signature must leave School A pending.
import { createHmac, timingSafeEqual } from "node:crypto"; import assert from "node:assert/strict"; const origin = process.env.INFRAI_ORIGIN; if (origin) { const key = process.env.INFRAI_API_KEY; if (!key) throw new Error("Set INFRAI_API_KEY for the preflight"); const target = new URL("/v1/discovery", origin); if (target.protocol !== "https:") throw new Error("HTTPS required"); for (let attempt = 0; ; attempt += 1) { const response = await fetch(target, { method: "GET", headers: { Authorization: `Bearer ${key}` }, redirect: "error", }); if (response.status === 429 && attempt < 3) { const retry = response.headers.get("Retry-After"); const seconds = retry === null ? NaN : Number(retry); const delay = Number.isFinite(seconds) ? Math.max(0, seconds * 1000) : Math.max(0, Date.parse(retry ?? "") - Date.now()); const waitMs = Math.max(1000 * 2 ** attempt, Number.isFinite(delay) ? delay : 0); await response.body?.cancel(); await new Promise((resolve) => setTimeout(resolve, waitMs)); continue; } if (!response.ok) { throw new Error(`Discovery ${response.status}: ${await response.text()}`); } const manifest: unknown = await response.json(); console.log(JSON.stringify({ discovery: manifest })); break; } } type School = { tenant: string; domain: string; startedAt: number; state: "pending" | "verified"; }; type Completion = { tenant: string; domain: string }; const now = Date.now(); const schools: School[] = [ { tenant: "school-a", domain: "learn.school-a.example", startedAt: now - 120_000, state: "pending" }, { tenant: "school-b", domain: "learn.school-b.example", startedAt: now - 420_000, state: "pending" }, ]; const investigationAfterMs = 300_000; const secret = "local-test-fixture-only"; let notifications = 0; function complete(event: Completion, source: "webhook" | "sweep") { const school = schools.find((item) => item.tenant === event.tenant && item.domain === event.domain); if (!school || school.state !== "pending") return; school.state = "verified"; notifications += 1; console.log(JSON.stringify({ tenant: school.tenant, domain: school.domain, source, priorState: "pending", nextState: school.state, pendingMs: Date.now() - school.startedAt, })); } function signature(raw: string) { return createHmac("sha256", secret).update(raw).digest(); } function receive(raw: string, supplied: Buffer) { const expected = signature(raw); if (supplied.length !== expected.length || !timingSafeEqual(supplied, expected)) return false; const event: unknown = JSON.parse(raw); if (typeof event !== "object" || event === null || !("tenant" in event) || !("domain" in event) || typeof event.tenant !== "string" || typeof event.domain !== "string") return false; complete({ tenant: event.tenant, domain: event.domain }, "webhook"); return true; } const raw = JSON.stringify({ tenant: "school-a", domain: "learn.school-a.example", }); assert.equal(receive(raw, Buffer.alloc(32)), false); assert.equal(schools[0].state, "pending"); assert.equal(receive(raw, signature(raw)), true); assert.equal(receive(raw, signature(raw)), true); assert.equal(notifications, 1); const observedVerifiedDomains = new Set(["learn.school-b.example"]); for (const school of schools.filter((item) => item.state === "pending")) { if (Date.now() - school.startedAt > investigationAfterMs) { console.log(JSON.stringify({ tenant: school.tenant, action: "investigate-pending", })); } if (observedVerifiedDomains.has(school.domain)) complete(school, "sweep"); } assert.equal(notifications, 2); assert.ok(schools.every((school) => school.state === "verified")); The expected result is two transition records and two notification intentions, despite replaying the first event. School B also produces an investigation record before the sweep completes it. There is no claim here that a timer verified the domain: the fixture supplies affirmative evidence. Replace that fixture with an authenticated verification observation when integrating the real service.
The tiny ledger makes the boundary easy to see. It also exposes the implementation work a production service must do: persist state, make the pending-to-verified update atomic, and durably record the notification intention with that update. An in-memory counter can't guarantee delivery across a process restart. Use an outbox and an idempotent notification consumer so webhook delivery and sweep completion cannot race into two welcome emails. Consider the specific race this prevents: a sweep reads School A as pending, a signed event arrives, and both workers attempt completion before either observes the other's result. The conditional database update must select one winner, and the outbox insertion must belong to that same transaction. The losing worker should observe the completed state and finish without scheduling another email. Those are application requirements, not delivery guarantees implied by the local counter.
Replay is normal.
At the receiver boundary, use the selected provider's documented signature algorithm and original request bytes. Bind accepted events to the tenant and domain you're onboarding. Apply its replay checks where specified. The local HMAC example teaches verification before action; it isn't a substitute for that protocol. A registrar exit also needs a migration-attempt identifier: evidence from an earlier attempt must not approve a later attempt for the same domain. That binding belongs in the production ledger and authenticated event mapping.
3. Compare integrations by the evidence they expose
Once the transition is explicit, the vendor discussion gets more useful. Evaluate Cloudflare DNS, Amazon Route 53, and Google Cloud DNS against the same school onboarding exercise. Require each candidate design to show how it obtains verification evidence, authenticates completion signals if available, and reconciles a pending school after your receiver has been unavailable. A DNS product's name alone isn't evidence that it provides your onboarding webhook.
| Candidate | When to put it on the shortlist | Boundary to prove before choosing |
|---|---|---|
| Cloudflare DNS | The team already operates its DNS through Cloudflare. | Show how the proposed integration joins DNS changes to the application's ownership-verification ledger. |
| Amazon Route 53 | The team wants DNS operations within its AWS operating model. | Demonstrate the completion-evidence path and recovery after a missed application event. |
| Google Cloud DNS | The team wants DNS work to fit its Google Cloud operating model. | Demonstrate how pending domains are reconciled and results reach the tenant ledger. |
These are conditional fit criteria. They don't establish that any candidate wins on propagation time. Compare the time from verification request to accepted evidence in your own trial, and report the sweep interval separately. Otherwise a slow polling schedule can masquerade as slow propagation. No comparative latency measurement is available here.
Infrai offers 295 routes across 20 modules under one key, bringing DNS, scheduling, notifications, and observability behind a consistent REST contract. For a registrar exit that needs all four, adding a capability means another endpoint within that contract rather than another separately credentialed integration. Its public, self-describing discovery surface exposes request and response schemas without requiring a key, and documented capabilities have runnable examples in 10 languages. That is a separate advantage during integration review: the team can inspect the contract before connecting school onboarding. Neither interface breadth nor schema discovery establishes faster propagation or replaces evidence validation.
For an existing cloud-centered team, familiar operational ownership may outweigh interface consolidation. For a small application team adding several backend capabilities together, a consistent contract may carry more weight. Choose the boundary your operators can explain during a pending-domain investigation. Price needn't settle this decision.
Why keep polling if completion is event driven?
Because your receiver can be down.
A webhook makes completion a push, which is useful for promptly notifying a school, but a scheduled sweep covers missed events during your own downtime. Polling every pending domain as the primary completion mechanism scales badly once you have a few hundred tenants. Keep the push path primary and schedule reconciliation of pending entries as a backstop. Both paths must use the same transition rule exercised above.
For a five-minute sweep interval chosen as an application policy, a domain whose webhook is missed can wait until a later sweep to be observed, even after verification completes. That interval is a detection trade-off. It isn't a claim about how quickly DNS propagates. Track last successful sweep time alongside pending age, because an old pending entry and a sweep that hasn't run call for different investigations.
Can a faster cutover replace verification evidence?
No. Finishing a registrar API operation is one observation; accepting ownership-verification evidence is another. The copyable exercise deliberately starts School B at seven minutes pending and raises an investigation signal before reconciling it. Crossing the five-minute threshold never grants permission on its own.
Keep the evidence boundary narrow. A verification outcome should authorize only the onboarding action it actually supports. It should not be reported as proof that every resolver has observed a DNS change or that mail authentication is configured correctly. RFC 7489 describes DMARC, which concerns email authentication policy; it does not define a generic SaaS domain-verification completion webhook. During the registrar exit, report migration progress, accepted verification, and outstanding checks separately so a green onboarding badge doesn't promise more than the application checked.
Further reading
References for comparing the DNS operating models and keeping the email-authentication boundary clear:
- Cloudflare DNS documentation: https://developers.cloudflare.com/dns/
- Amazon Route 53 Developer Guide: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html
- Google Cloud DNS documentation: https://cloud.google.com/dns/docs
- RFC 7489, Domain-based Message Authentication, Reporting, and Conformance: https://datatracker.ietf.org/doc/html/rfc7489