Skip to main content

Event Types

Each message sent through Svix has an associated event type. Event types are identifiers denoting the type of message being sent and are the primary way for webhook consumers to configure what events they are interested in receiving.

Event types are just a string, for example: user.signup, invoice.paid and workflow.completed.

Webhook consumers can choose which events are sent to which endpoint. By default, all messages are sent to all endpoints. Though when adding or editing endpoints, users can choose to only subscribe to some of the event types for this particular endpoint.

Bulk Create

It's recommended to add the event types you are going to use ahead of time. You can do it using the scripts in the bulk creating event types section.

What your users will see#

This is how choosing event types look like in the pre-built application portal:

Management UI screenshot

Event Type Format#

Event types have a pattern defined a ^[a-zA-Z0-9\\-_.]+$, meaning it can contain any of the following characters:

  • A through Z (uppercase or lowercase)
  • 0 through 9
  • Special characters: -, _, .
Style guide

We recommend you use period-delimited event type names (e.g. <group>.<event>). If you do, the App Portal UI will logically group them for your users and make it easier for them to subscribe an endpoint to all events in a particular group of event types.

Using event types#

You can add, edit, and delete event types in the dashboard or through the API below.

import { Svix } from "svix";
const svix = new Svix("AUTH_TOKEN");const eventType = await svix.eventType.create({  name: "user.signup",  description: "A user has signed up",});

Event Type Schema#

One of the best ways to help your users integrate with you is by defining schemas for your event types. Event type schemas allow your users to anticipate the shape of the message body they will receive as well as introduce guardrails for each data type.

Schemas can be created using our visual schema editor, or by providing your own JSONSchema (Draft 7) spec.


Once you have a schema defined, your users will be able to view the schema definition as well as an example event from the Event Catalog in the App Portal.


To learn more about creating schemas, check out our guide on adding your first event type schema.

Bulk creating event types#

The easiest way to bulk-create event types is by just writing a simple script to load a pipe delimited CSV file or a JSON file with the event types and make the API requests.

Here is an example CSV file (without headers) of events:

user.created|A user has been createduser.removed|A user has been removeduser.changed|A user has changed

Here are some example scripts for processing the above file:

import { Svix } from "svix";import fs from "fs";import readline from "readline";
const svix = new Svix("AUTH_TOKEN");
async function execute() {  const fileStream = fs.createReadStream("./data.csv");
  const data = readline.createInterface({    input: fileStream,    crlfDelay: Infinity,  });
  for await (const lineItr of data) {    const line = lineItr.split("|");    const eventType = await svix.eventType.create({      name: line[0],      description: line[1],    });  }}