TwitchLib.EventSub.Webhooks 1.0.0

.NET 5.0
There is a newer version of this package available.
See the version list below for details.
Install-Package TwitchLib.EventSub.Webhooks -Version 1.0.0
dotnet add package TwitchLib.EventSub.Webhooks --version 1.0.0
<PackageReference Include="TwitchLib.EventSub.Webhooks" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TwitchLib.EventSub.Webhooks --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TwitchLib.EventSub.Webhooks, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install TwitchLib.EventSub.Webhooks as a Cake Addin
#addin nuget:?package=TwitchLib.EventSub.Webhooks&version=1.0.0

// Install TwitchLib.EventSub.Webhooks as a Cake Tool
#tool nuget:?package=TwitchLib.EventSub.Webhooks&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


Provides an easy way to setup a Twitch EventSub Webhooks Server

Setting up a Twitch EventSub server can be daunting and has some moving parts that you could get wrong. TwitchLib.EventSub.Webhooks was build with that in mind and makes it as easy as it can get. You only need a few lines of code to add and configure it.

Step 1: Create a new ASP.NET Core project (.NET 5.0 and up)

Step 2: Install the TwitchLib.EventSub.Webhooks nuget package.

Step 3: Add necessary services and config to the DI Container

public void ConfigureServices(IServiceCollection services)
    services.AddTwitchLibEventSubWebhooks(config =>
        config.CallbackPath = "/webhooks";
        config.Secret = "supersecuresecret";
        config.EnableLogging = true;


Step 4: Put the TwitchLib.EventSub.Webhooks middleware in the request pipeline

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    if (env.IsDevelopment())




    app.UseEndpoints(endpoints =>

Step 5: Create the HostedService and listen for events

using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Threading;
using System.Threading.Tasks;
using TwitchLib.EventSub.Webhooks.Core;
using TwitchLib.EventSub.Webhooks.Core.EventArgs;
using TwitchLib.EventSub.Webhooks.Core.EventArgs.Channel;

namespace TwitchLib.EventSub.Webhooks.Example
    public class EventSubHostedService : IHostedService
        private readonly ILogger<EventSubHostedService> _logger;
        private readonly ITwitchEventSubWebhooks _eventSubWebhooks;

        public EventSubHostedService(ILogger<EventSubHostedService> logger, ITwitchEventSubWebhooks eventSubWebhooks)
            _logger = logger;
            _eventSubWebhooks = eventSubWebhooks;

        public Task StartAsync(CancellationToken cancellationToken)
            _eventSubWebhooks.OnError += OnError;
            _eventSubWebhooks.OnChannelFollow += OnChannelFollow;
            return Task.CompletedTask;

        public Task StopAsync(CancellationToken cancellationToken)
            _eventSubWebhooks.OnError -= OnError;
            _eventSubWebhooks.OnChannelFollow -= OnChannelFollow;
            return Task.CompletedTask;

        private void OnChannelFollow(object sender, ChannelFollowArgs e)
            _logger.LogInformation($"{e.Notification.Event.UserName} followed {e.Notification.Event.BroadcasterUserName} at {e.Notification.Event.FollowedAt.ToUniversalTime()}");

        private void OnError(object sender, OnErrorArgs e)
            _logger.LogError($"Reason: {e.Reason} - Message: {e.Message}");

That is all that you need to do to setup a Twitch EventSub Webhook Server with TwitchLib.EventSub.Webhooks. Easy isn't it?

Alternatively you can also just clone the

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 705 11/22/2021
1.1.0 167 9/1/2021
1.0.0 144 8/25/2021

Initial release