What is svix?
The svix npm package is a powerful tool for managing webhooks. It provides a comprehensive set of features for sending, receiving, and managing webhooks in a secure and reliable manner.
What are svix's main functionalities?
Sending Webhooks
This feature allows you to send webhooks to a specified endpoint. You can define the event and payload, and the svix package will handle the delivery.
const { Svix } = require('svix');
const svix = new Svix('your-api-key');
const payload = { event: 'user.created', data: { userId: '12345' } };
svix.message.create('your-app-id', payload).then(response => {
console.log('Webhook sent:', response);
}).catch(error => {
console.error('Error sending webhook:', error);
});
Receiving Webhooks
This feature allows you to receive and verify webhooks. The svix package provides a method to verify the webhook signature to ensure the payload is authentic.
const express = require('express');
const { Svix } = require('svix');
const app = express();
const svix = new Svix('your-api-key');
app.post('/webhook', express.json(), (req, res) => {
const payload = req.body;
const headers = req.headers;
if (svix.verify(payload, headers, 'your-webhook-secret')) {
console.log('Webhook received:', payload);
res.status(200).send('Webhook received');
} else {
res.status(400).send('Invalid signature');
}
});
app.listen(3000, () => {
console.log('Server is running on port 3000');
});
Managing Webhooks
This feature allows you to manage your webhooks, including listing all webhooks and deleting specific webhooks. The svix package provides methods to interact with the webhook endpoints.
const { Svix } = require('svix');
const svix = new Svix('your-api-key');
// List all webhooks
svix.endpoint.list('your-app-id').then(response => {
console.log('Webhooks:', response);
}).catch(error => {
console.error('Error listing webhooks:', error);
});
// Delete a webhook
svix.endpoint.delete('your-app-id', 'webhook-id').then(response => {
console.log('Webhook deleted:', response);
}).catch(error => {
console.error('Error deleting webhook:', error);
});
Other packages similar to svix
webhook
The webhook npm package provides basic functionality for sending and receiving webhooks. It is less feature-rich compared to svix but can be a simpler alternative for basic webhook management.
node-webhooks
The node-webhooks package offers a simple way to create and manage webhooks in Node.js. It is more lightweight compared to svix and may lack some advanced features like signature verification and comprehensive management tools.
webhooks.js
webhooks.js is a library for handling webhooks in Node.js. It provides basic functionality for sending and receiving webhooks but does not offer the same level of security and management features as svix.
Typescript/Javascript library for interacting with the Svix API and verifying webhook signatures


Usage Documentation
You can find general usage documentation at https://docs.svix.com. For complete API documentation with code examples for each endpoint in all of our official client libraries head over to our API documentation site at https://api.svix.com.
Language Support
⚡️ Features ⚡️ |
---|
Officially Supported | ✅ |
---|
API Support | ✅ |
---|
Signature Verification | ✅ |
---|
Caveats | None! 🚀 |
---|
Installation
npm install svix
yarn add svix
Usage
import { Svix } from "svix";
const svix = new Svix("AUTH_TOKEN");
const app = await svix.application.create({ name: "Application name" });
Development
First checkout the core README for details on how to generate our API bindings, then follow the steps below.
Requirements
Building the library
yarn
yarn build
Contributing
Before opening a PR be sure to format your code!
yarn lint:fix
Running Tests
Simply run:
yarn test