
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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.
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);
});
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.
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 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.
Svix - Webhooks as a service
Typescript/Javascript library for interacting with the Svix API and verifying webhook signatures
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.
⚡️ Features ⚡️ | |
---|---|
Officially Supported | ✅ |
API Support | ✅ |
Signature Verification | ✅ |
Caveats | None! 🚀 |
npm install svix
# or
yarn add svix
import { Svix } from "svix";
const svix = new Svix("AUTH_TOKEN");
const app = await svix.application.create({ name: "Application name" });
First checkout the core README for details on how to generate our API bindings, then follow the steps below.
yarn
yarn build
Before opening a PR be sure to format your code!
yarn lint:fix
Simply run:
yarn test
Version 1.57.0
This version contains a big overhaul of the client libraries, with improved typing.
Libs/Go: Add Authentication.ExpireAll
(and ExpireAllWithOptions
)
Libs/Go (Breaking): Excluding specific fields on the *Patch models (ApplicationPatch
for example), all Nullable{Type}
removed from the models
Libs/Go (Breaking): All Nullable{Type}
(for example NullableString
) are replaced with a new generic Nullable[T]
type, the new type can be imported from github.com/svix/svix-webhooks/go/utils
Libs/Go (Breaking): All custom model types are now imported from github.com/svix/svix-webhooks/go/models
instead of github.com/svix/svix-webhooks/go
Libs/Go (Breaking): All -WithOptions
methods are now removed. Their regular counterparts now take a pointer to an Options type which can be nil when not needed. For example in Endpoint.RecoverWithOptions
is now Endpoint.Recover
Libs/C# and Libs/Go (Breaking): All uses of ListOptions
/PostOptions
are removed, and renamed to {Resource}{Operation}Options
. For example in Endpoint.List
you would now use EndpointListOptions
Libs/C# (Breaking): All IdempotencyKey
method parameters are removed, and are now part of {Resource}{Operation}Options
. For example in Message.Create
; to the use IdempotencyKey
, simply pass it in the MessageCreateOptions
Libs/C# (Breaking): The Throw
parameter is removed from SvixOptions
Libs/C# (Breaking): All redundant interfaces along with the Svix.Abstractions
namespace are removed
Libs/C# (Breaking): The Svix.Model
and Svix.Models
namespaces are now merged into a single Svix.Models
namespace
Libs/C# (Breaking): The Svix.Client
namespace is removed, The SvixClient
class can now be found in the Svix
namespace
Libs/Python (Breaking): PostOptions
and ListOptions
are no longer used in methods for Authentication
,Endpoint
,EventType
,Integration
,MessageAttempt
,Message
, Statistics
and OperationalWebhookEndpoint
resources. Instead each API call now has its own {Resource}{Operation}Options
. (Both sync and async)
Libs/Python: In Application
the dashboard_access
method is deprecated in favor of app_portal_access
. (Both sync and async)
Libs/Python (Breaking): EndpointStatsOptions
is renamed to EndpointGetStatsOptions
Libs/Python (Breaking): MessageAttemptListOptions
is removed in favor of call specific {Resource}{Operation}Options
Libs/Python (Breaking): For Statistics
in the aggregate_event_types
method the task_id
parameter is removed, Please note that previously this parameter was ignored and had no affect (Both sync and async)
Libs/Kotlin (Breaking): Mark api
field of all API resource classes as private
(previously
only some were private, accidentally)
Libs/Kotlin (Breaking): Update recover
to return RecoverOut
(instead of nothing)
Libs/Kotlin (Breaking): Update replayMissing
to return ReplayOut
(instead of nothing)
Libs/Kotlin (Breaking): Update sendExample
to return MessageOut
(instead of nothing)
Libs/Kotlin (Breaking): Update MessageAttempt
list methods to each have its own type for
list options, since they don't all support the exact same set of parameters and some of the
parameters that could be set before would just get ignored
Libs/Kotlin: Fix a bug in EventType.list
where options.order
was not getting honored
Libs/Rust (Breaking): Add optional EventTypeDeleteOptions
parameter to EventType::delete
Libs/Rust (Breaking): Add optional options
parameters to Endpoint::recover
,
Endpoint::rotate_secret
, Integration::rotate_key
and MessageAttempt::resend
Libs/Rust (Breaking): Remove model files that were not referenced by any operations available
through the Svix
object
Libs/Rust (Breaking): Switch Patch
struct fields from Option<Option<T>>
to
js_option::JsOption<T>
Libs/Rust (Breaking): Change rate_limit
from i32
to u16
in several places
Libs/Rust (Breaking): Remove settings
parameter from EnvironmentIn::new
Libs/Rust (Breaking): Replace PostOptions
with operation-specific options structs
Libs/Rust (Breaking): Remove Period
from BackgroundTaskType
variant names; this was introduced by accident a few releases ago
FAQs
Svix webhooks API client and webhook verification library
The npm package svix receives a total of 151,496 weekly downloads. As such, svix popularity was classified as popular.
We found that svix demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.