Technical example
Verify before acknowledging
Use the pattern as a starting point and align URLs, schemas, scopes, timeouts, and error handling with the contract for your environment.
const rawBody = await request.text();
const signature = request.headers.get("x-sc-signature");
const timestamp = request.headers.get("x-sc-timestamp");
verifyWebhook({ rawBody, signature, timestamp, secret });
const event = JSON.parse(rawBody);
await eventStore.recordOnce(event.id, rawBody);
await queue.publish({ eventId: event.id });
return new Response(null, { status: 204 });