Octokit.Webhooks
4.2.0
Prefix Reserved
dotnet add package Octokit.Webhooks --version 4.2.0
NuGet\Install-Package Octokit.Webhooks -Version 4.2.0
<PackageReference Include="Octokit.Webhooks" Version="4.2.0" />
<PackageVersion Include="Octokit.Webhooks" Version="4.2.0" />
<PackageReference Include="Octokit.Webhooks" />
paket add Octokit.Webhooks --version 4.2.0
#r "nuget: Octokit.Webhooks, 4.2.0"
#:package Octokit.Webhooks@4.2.0
#addin nuget:?package=Octokit.Webhooks&version=4.2.0
#tool nuget:?package=Octokit.Webhooks&version=4.2.0
Octokit.Webhooks
Libraries to handle GitHub Webhooks in .NET applications.
Usage
ASP.NET Core
dotnet add package Octokit.Webhooks.AspNetCoreCreate a class that derives from
WebhookEventProcessorand override any of the virtual methods to handle webhooks from GitHub. For example, to handle Pull Request webhooks:public sealed class MyWebhookEventProcessor : WebhookEventProcessor { protected override ValueTask ProcessPullRequestWebhookAsync( WebhookHeaders headers, PullRequestEvent pullRequestEvent, PullRequestAction action, CancellationToken cancellationToken = default) { ... } }Register your implementation of
WebhookEventProcessor:builder.Services.AddSingleton<WebhookEventProcessor, MyWebhookEventProcessor>();Map the webhook endpoint:
app.UseEndpoints(endpoints => { ... endpoints.MapGitHubWebhooks(); ... });
MapGitHubWebhooks() takes two optional parameters:
path. Defaults to/api/github/webhooks, the URL of the endpoint to use for GitHub.secret. The secret you have configured in GitHub, if you have set this up.
By default, exceptions thrown while processing a webhook are logged and return
HTTP 500. Configure GitHubWebhookOptions.ExceptionHandler to handle specific
exceptions and control the response:
builder.Services.Configure<GitHubWebhookOptions>(options =>
{
options.ExceptionHandler = (exception, context) =>
{
if (exception is JsonException)
{
context.Response.StatusCode = StatusCodes.Status400BadRequest;
return ValueTask.FromResult(true);
}
return ValueTask.FromResult(false);
};
});
Returning true means the callback has completed the response. Returning
false uses the default HTTP 500 behavior.
Azure Functions
NOTE: Support is only provided for isolated process Azure Functions.
dotnet add package Octokit.Webhooks.AzureFunctionsCreate a class that derives from
WebhookEventProcessorand override any of the virtual methods to handle webhooks from GitHub. For example, to handle Pull Request webhooks:public sealed class MyWebhookEventProcessor : WebhookEventProcessor { protected override ValueTask ProcessPullRequestWebhookAsync( WebhookHeaders headers, PullRequestEvent pullRequestEvent, PullRequestAction action, CancellationToken cancellationToken = default) { ... } }Register your implementation of
WebhookEventProcessorand configure the webhook function:var builder = FunctionsApplication.CreateBuilder(args); builder.Services.AddSingleton<WebhookEventProcessor, MyWebhookEventProcessor>(); builder.ConfigureGitHubWebhooks(); builder.Build().Run();
ConfigureGitHubWebhooks has two overloads:
ConfigureGitHubWebhooks(string? secret = null). Pass the secret you have configured in GitHub, if you have set this up.ConfigureGitHubWebhooks(Func<IConfiguration, string> configure). Resolve the secret from configuration at runtime.
The function is available on the /api/github/webhooks endpoint.
Thanks
License
All packages in this repository are licensed under the MIT license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Macross.Json.Extensions (>= 3.0.0)
- Microsoft.Extensions.Primitives (>= 10.0.11)
- System.Text.Json (>= 10.0.11)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Octokit.Webhooks:
| Package | Downloads |
|---|---|
|
Octokit.Webhooks.AspNetCore
GitHub webhook events toolset for .NET |
|
|
Octokit.Webhooks.AzureFunctions
GitHub webhook events toolset for Azure Functions |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.2.0 | 171 | 8/30/2026 |
| 4.1.3 | 697 | 8/26/2026 |
| 4.1.2 | 5,514 | 8/13/2026 |
| 4.1.1 | 3,945 | 7/31/2026 |
| 4.1.0 | 2,737 | 7/28/2026 |
| 4.0.4 | 8,833 | 6/28/2026 |
| 4.0.3 | 10,717 | 6/4/2026 |
| 4.0.2 | 4,708 | 5/26/2026 |
| 4.0.1 | 8,708 | 5/12/2026 |
| 4.0.0 | 15,307 | 4/14/2026 |
| 4.0.0-rc.2 | 163 | 4/14/2026 |
| 4.0.0-rc.1 | 168 | 4/14/2026 |
| 3.2.1 | 92,178 | 9/11/2025 |
| 3.1.0 | 5,489 | 9/2/2025 |
| 3.0.0 | 96,396 | 7/18/2025 |
| 2.5.1 | 29,211 | 6/26/2025 |
| 2.5.0 | 403 | 6/26/2025 |
| 2.4.1 | 68,266 | 10/22/2024 |
| 2.4.0 | 7,041 | 10/9/2024 |
| 2.3.0 | 2,015 | 10/2/2024 |