Skip to content

feat(sdk): add webhook consumer support - #3376

Open
Sanderhoff-alt wants to merge 1 commit into
vectorize-io:mainfrom
Sanderhoff-alt:feat/webhook-consumer-sdks
Open

feat(sdk): add webhook consumer support#3376
Sanderhoff-alt wants to merge 1 commit into
vectorize-io:mainfrom
Sanderhoff-alt:feat/webhook-consumer-sdks

Conversation

@Sanderhoff-alt

@Sanderhoff-alt Sanderhoff-alt commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Add webhook consumer APIs to the Python, TypeScript, Go, and Rust SDKs. The SDKs verify the exact raw request body, parse known events into generated models, and preserve unknown events through a forward-compatible envelope.

Technical Design

The main OpenAPI document remains the single source of truth for webhook event schemas. Ordinary client generation uses a validated projection that removes only the top-level webhooks keyword because the current generators do not handle OpenAPI 3.1 webhooks consistently. Webhook component schemas remain available to the generated clients.

The consumer layer is intentionally hand-written. It owns raw-body handling, HMAC-SHA256 verification, constant-time comparison, header extraction, event dispatch, and the verify-before-parse workflow. Generated code owns event models, field types, serialization, and deserialization.

Known events are selected from the signed body event discriminator. Unknown event names are returned as forward-compatible envelopes that preserve unknown top-level and data fields. The TypeScript API exposes a discriminated kind wrapper so callers can narrow known and unknown events safely.

TypeScript runtime validation is generated from the same OpenAPI schemas and compiled with Ajv. The validator map is derived from the generated discriminator mapping rather than maintaining a second hard-coded event list. Python enforces the same RFC3339 timestamp contract at the consumer boundary, while Go and Rust rely on their generated model deserializers and standard date-time parsers.

The client-generation scripts validate projection invariants, schema references, generated webhook artifacts, and deterministic schema output. The root lockfile records the TypeScript runtime dependencies.

Scope

This PR is limited to consumer-side event models, raw-body signature verification, parsing, forward-compatible unknown event handling, and usage documentation. It does not change the webhook delivery protocol or server retry behavior.

GET delivery consumption remains outside the current contract because main currently signs a payload but sends an empty GET body; the consumer APIs are method-independent once the sender emits the signed body.

Verification

Webhook tests pass for the server, Python, TypeScript, Go, and Rust consumers. TypeScript type-checking and production build pass, schema generation is deterministic across hash seeds, Python scripts compile, and npm ci --dry-run validates the lockfile dependency graph.

Closes #3071

@Sanderhoff-alt
Sanderhoff-alt force-pushed the feat/webhook-consumer-sdks branch from dd2a08a to 307a682 Compare August 11, 2026 08:20
Add webhook event models and consumer APIs to the Python, TypeScript,
Go, and Rust SDKs, including raw-body HMAC verification, parse-only
helpers, verify-then-parse entry points, and forward-compatible handling
for unknown events.
Keep ordinary client generation on an OpenAPI projection without the
top-level webhooks keyword while preserving webhook component schemas.
Extract and validate that projection through reusable build scripts.
Generate the TypeScript runtime validation schema from OpenAPI and use
Ajv instead of maintaining a separate hand-written field list.
Return TypeScript events through a discriminated known/unknown wrapper.
@Sanderhoff-alt
Sanderhoff-alt force-pushed the feat/webhook-consumer-sdks branch from 307a682 to 386c65d Compare August 11, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add official SDK support for consuming and verifying webhooks

1 participant