How to Create Event Types Via OpenAPI Import

Written by tomhacohen | Published 2023/08/10
Tech Story Tags: web-development | webhook | openapi | open-api | guide | webhook-integration | event-types | svix

TLDRThe 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.via the TL;DR App

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.

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

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.

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


Written by tomhacohen | I obsess over webhooks as Founder and CEO of Svix.
Published by HackerNoon on 2023/08/10