Svix Blog
Published on

Create Event Types via OpenAPI Import

  • avatar
    Luciano Bianchi

Cover image

The key to providing an easy webhook integration experience for your users lies in your event types. The first thing your users are interested in seeing when integrating with you is what events you send and what information those events provide. You should consider event types (and their schemas) as part of your API. Hence, they need to be accurate and up to date.

Using your OpenAPI specification

If you have an API you offer to your customers, it's quite likely you have an OpenAPI specification already documenting it. You can now use that same OpenAPI file as a quick and easy way to create and update Svix Event Types.

The OpenAPI 3.1 spec already defines a webhooks section as part of the standard. If your API docs define this field, you have all you need to create event types in Svix with no additional changes.

This can be a great option if you want to avoid error-prone manual changes and don't need to update event types very often. If you update event types frequently, a programmatic integration might me more appropriate.

How it works

In the Event Types section in your dashboard, select "Import from OpenAPI" and upload your OpenAPI file.

Import OpenAPI config button

Once your spec is uploaded, Svix will parse the webhooks section and suggest event types based on your existing definitions.

Parsed event types

All you need to do is set the event type name and hit 'Save'. You might want this name to be slightly different than the name in your API definition, for better readability. If an event type with that name already exists, it will get updated.

That's it! You used your existing API definition to add event types to Svix, no extra work needed. Schemas, descriptions and examples can all be read from the OpenAPI spec, and can be kept up to date with your API this way.

Event type details

Check out the docs to learn more about how to get the most out of this integration.

For more content like this, make sure to follow us on Twitter, Github or RSS for the latest updates for the Svix webhook service, or join the discussion on our community Slack.