#14770·spree

Typed Webhook Events

Author: damianlegawiecCreated Sep 29, 2026Updated Sep 30, 2026

Spree publishes about 110 webhook events, but nothing declares them. Event names are string literals spread across models, workflows and controllers; the dashboard keeps its own hand-copied list that already drifts from the server; and @spree/sdk/webhooks types every payload as unknown. This plan declares every event once in Ruby — its name and the serializer that builds its payload — and generates everything else from that declaration: a typed event map and a verified constructWebhookEvent in @spree/sdk/webhooks, Zod schemas for runtime checks, and an Admin API endpoint the dashboard reads its event picker from.

Status: Draft — design finalized 2026-09-29, nothing built.

Depends on: Admin API (webhook endpoints are Admin API resources); Zod schemas for every SDK (shipped in #14763).

Key decisions: payloads stay on Store API serializers; back-office data is fetched from the Admin API by ID; events are declared on the model whose record is the payload; undeclared events raise in development and test and warn in production.

Steps

  1. Add the event catalog and the publishes_events / publishes_event declarations; lifecycle events register themselves. Warn on undeclared names.
  2. Declare every core event; replace hand-built payload hashes with event serializers; replace the credential event list with the catalog's flag.
  3. Raise on undeclared names in development and test.
  4. Generate the event types and Zod schemas; add constructWebhookEvent; extend the CI drift check.
  5. Add GET /api/v3/admin/webhook_events and move the dashboard picker onto it.
  6. Document the event reference from the catalog.

Plan: https://github.com/spree/spree/blob/main/docs/plans/6.0-typed-webhook-events.md

Tracked in Linear as V-3728