![]() |
VOOZH | about |
dotnet add package Clerk.Webhooks --version 0.0.2
NuGet\Install-Package Clerk.Webhooks -Version 0.0.2
<PackageReference Include="Clerk.Webhooks" Version="0.0.2" />
<PackageVersion Include="Clerk.Webhooks" Version="0.0.2" />Directory.Packages.props
<PackageReference Include="Clerk.Webhooks" />Project file
paket add Clerk.Webhooks --version 0.0.2
#r "nuget: Clerk.Webhooks, 0.0.2"
#:package Clerk.Webhooks@0.0.2
#addin nuget:?package=Clerk.Webhooks&version=0.0.2Install as a Cake Addin
#tool nuget:?package=Clerk.Webhooks&version=0.0.2Install as a Cake Tool
A collection of multiple clerk packages for .NET.
Clerk is adding support for clerk.com to .NET.
Clerk.Webhooks is a simple extension for supporting webhooks from clerk.com.
Clerk is available as a NuGet package and can be installed as
Install-Package Clerk
or via the .NET Core command line interface:
dotnet add package Clerk
Clerk.Webhooks is available as a NuGet package and can be installed as
Install-Package Clerk.Webhooks
or via the .NET Core command line interface:
dotnet add package Clerk.Webhooks
Webhook events are simple data classes whose only purpose is to hold the data from the webhook. The data is automatically deserialized from the webhook request.
Events are custom defined in order to enable better flexibility in case of data changes from the event catalog at clerk.com.
For example, if you would like to have a webhook event for when a user is created, you can create a class like this:
public class UserCreated
{
public string Id { get; set; }
public string Username { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("last_name")
public string LastName { get; set; }
}
using Clerk.Webhooks;
public class UserCreatedWebhookHandler : IWebhookHandler<UserCreated>
{
public Task HandleAsync(Webhook<UserCreated> webhook, CancellationToken cancellationToken)
{
// Do something with the webhook event
}
}
The webhook handlers works with dependency injection, so you can inject any service you need into the handler by its constructor.
using Clerk.Webhooks;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddClerkWebhooks(webhookBuilder =>
{
// using predefined event names
webhookBuilder.AddHandler<UserCreated, UserCreatedWebhookHandler>(@event => @event.User.Created);
// or simply using string
webhookBuilder.AddHandler<UserCreated, UserCreatedWebhookHandler>("user.created");
});
using Clerk.Webhooks;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddClerkWebhooks(webhookBuilder =>
{
webhookBuilder.AddHandler<UserCreated, UserCreatedWebhookHandler>(@event => @event.User.Created);
// Adding signing credentials for webhook validation using svix under the hood
webhookBuilder.AddSigningSecret("signing-secret");
});
In order to enable request to the webhook endpoint, you need to add the middleware to the request pipeline.
By default, it uses the route prefix '/clerk', but you can change it to whatever you want.
Example using the default route prefix:
using Clerk.Webhooks;
app = builder.build();
app.UseClerkWebhooks();
Example using a custom route prefix:
using Clerk.Webhooks;
app = builder.build();
app.UseClerkWebhooks(options =>
{
options.RoutePrefix = "/my-webhook-endpoint";
});
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.2 | 1,639 | 9/22/2023 |
| 0.0.1 | 616 | 9/22/2023 |
| 0.0.0-alpha.1 | 178 | 9/22/2023 |