Webhooks & SSE Streams
Inbound marketplace webhooks with idempotency, and the admin SSE traffic stream.
Inbound webhooks
Marketplaces POST order and inventory events to eListSync webhook routes (channel-specific paths). Workers reconcile stock using the canonical SKU. Unrecognized SKUs are logged, not guessed.
Idempotency
Each event id is stored on webhook_events with a TTL on the order of 24 hours. Duplicate deliveries (marketplace retries) decrement stock **once**.
SSE traffic stream
Admin observability: GET /api/traffic/stream as EventSource. Payloads include RPS, latency sparklines, and recent request events for the admin terminal. This is not a customer webhook; operators should not build storefront logic on it.
const es = new EventSource('/api/traffic/stream');
es.onmessage = (e) => console.log(JSON.parse(e.data));Verify signatures
Inbound webhooks use HMAC (timing-safe compare). Reject unsigned bodies. Rotate channel secrets in Destinations if a signature fails after a marketplace key change.