Add webhooks to your SDKs
Why use the webhooks feature?
- Built-in SDK support: It simplifies webhook adoption through built-in SDK support.
- Abstracted complexity: Consumers don’t need to worry about cryptographic operations or dependencies.
- Default security: Consumers must verify the signature to unpack the webhook data.
- Type-safe consumption: Consumers get schema-validated data and types.
- Type-safe sending: Producers can send schema-validated data through type-safe SDK methods.
Getting started
Info
Webhooks are a paid add-on, reach out to us to discuss pricing
- You must have a Speakeasy Business or Enterprise plan.
- Enable the webhooks add-on to your account under
settings/billing
:

Example
GitHub example source code
You can see the full source code for this example in the webhooks example repo
OpenAPI
For webhook consumers
The validateWebhook()
function is currently only implemented in the TypeScript SDK, with support for additional languages planned for future releases. While other languages will generate webhook types, this discriminator method is TypeScript-only.
Error handling
For webhook producers
x-speakeasy-webhooks
The x-speakeasy-webhooks
extension is used to define the webhooks for your API.
x-speakeasy-webhooks.security
x-speakeasy-webhooks.security.type: signature
This will apply HMAC SHA256 to the body of the webhook request and put it in a header.
x-speakeasy-webhooks.security.type: custom
This generates the src/hooks/webhooks-custom-security.ts
boilerplate file, which you can then use to modify the security logic.
See the source code for this example in the GitHub repo
Last updated on