paint-brush
How to Create Event Types Via OpenAPI Importby@tomhacohen
158 reads

How to Create Event Types Via OpenAPI Import

by Tom HacohenAugust 10th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The OpenAPI 3.1 spec already defines a webhooks section. 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.
featured image - How to Create Event Types Via OpenAPI Import
Tom Hacohen HackerNoon profile picture

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 be more appropriate.

How It Works

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

Import the 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'. For better readability, you might want this name to be slightly different than the name in your API definition. 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 is 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 TwitterGitHub, or RSS for the latest updates for the Svix webhook service, or join the discussion on our community Slack.


Also published here