Speakeasy Logo
Skip to Content

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

  1. You must have a Speakeasy Business or Enterprise plan.
  2. Enable the webhooks add-on to your account under settings/billing:
app.speakeasy.com
Webhooks add on in the Speakeasy dashboard.

Example

OpenAPI

For webhook consumers

Error handling

For webhook producers

x-speakeasy-webhooks

The x-speakeasy-webhooks extension is used to define the webhooks for your API.

Property
Type
Description
The security configuration for the webhooks.

x-speakeasy-webhooks.security

Property
Type
Description
The type of security to use for the webhooks. Valid values are
and
.
Type
Description
The name of the header to use for the security token / signature.
Type
Description
The text encoding of the signature. Applicable to
.
Type
Description
The algorithm to use for the signature. Valid values are:
.

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