Slackbot.Net.Endpoints 6.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Slackbot.Net.Endpoints --version 6.0.4
                    
NuGet\Install-Package Slackbot.Net.Endpoints -Version 6.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Slackbot.Net.Endpoints" Version="6.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Slackbot.Net.Endpoints" Version="6.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Slackbot.Net.Endpoints" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Slackbot.Net.Endpoints --version 6.0.4
                    
#r "nuget: Slackbot.Net.Endpoints, 6.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Slackbot.Net.Endpoints@6.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Slackbot.Net.Endpoints&version=6.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Slackbot.Net.Endpoints&version=6.0.4
                    
Install as a Cake Tool

Slackbot.NET

Build

What?

An opinionated ASP.NET Core middleware to create simple Slackbots using the Slack event API.

Install

Download it from NuGet:NuGet

$ dotnet add package slackbot.net.endpoints

Supported events

  • challenge
  • app_mention
  • view_submission
  • member_joined_channel

Configuration

A slack app can be distributed either as a single-workspace application (1 single Slack token), or as a distributed Slack application where other workspaces can install it them self either via a web page, or via the Slack App Store.

Single workspace Slack app

var builder = WebApplication.CreateBuilder(args);

// Needed to verify that incoming event payloads are from Slack
builder.Services.AddAuthentication()
                .AddSlackbotEvents(c =>
                    c.SigningSecret = Environment.GetEnvironmentVariable("SIGNING_SECRET")
                );

// Setup event handlers
builder.Services.AddSlackBotEvents()
                .AddAppMentionHandler<DoStuff>()


var app = builder.Build();
app.UseSlackbot(); // event endpoint
app.Run();

class DoStuff : IHandleAppMentions
{
    public bool ShouldHandle(AppMentionEvent slackEvent) => slackEvent.Text.Contains("hi");

    public Task<EventHandledResponse> Handle(EventMetaData meta, AppMentionEvent @evt)
    {
        Console.WriteLine("Doing stuff!");
        return Task.FromResult(new EventHandledResponse("yolo"));
    }
}

Advanced: Distributed Slack app

Implement the ITokenStore to store/remote on install/uninstall flows.

var builder = WebApplication.CreateBuilder(args);

// Needed to verify that incoming event payloads are from Slack
builder.Services.AddAuthentication()
               .AddSlackbotEvents(c => c.
                   SigningSecret = Environment.GetEnvironmentVariable("SIGNING_SECRET")
               );

builder.Services.AddSlackbotDistribution(c => {
   c.CLIENT_ID = Environment.GetEnvironmentVariable("CLIENT_ID");
   c.CLIENT_SECRET = Environment.GetEnvironmentVariable("CLIENT_SECRET");
});

// Setup event handlers
builder.Services.AddSlackBotEvents<MyTokenStore>()
               .AddAppMentionHandler<DoStuff>()


var app = builder.Build();
app.Map("/authorize", a => a.UseSlackbotDistribution()); // OAuth callback endpoint
app.Map("/events", a => a.UseSlackbot()); // event endpoint
app.Run();


/// Bring-your-own-token-store:
class MyTokenStore : ITokenStore
{
   // _db is some persistance technology you choose (sql, mongo, whatever)
   public Task<Workspace Delete(string teamId) => _db.DeleteByTeamId(teamId);
   public Task Insert(Workspace slackTeam) => _db.Insert(slackTeam);
}

Samples

Check the samples.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.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
8.1.4-ci0007-df7119f 110 8/3/2026
8.1.4-ci0005-1902179 152 6/1/2026
8.1.4-ci0002-2309f2a 170 3/3/2026
8.1.3 370 1/20/2026
8.1.2 135 1/19/2026
8.1.1 137 1/16/2026
8.1.1-ci0008-72428ca 127 1/16/2026
8.1.1-ci0007-f239f4b 135 1/16/2026
8.1.1-ci0006-b73d8e5 131 1/16/2026
8.1.1-ci0005-ff119ff 142 1/8/2026
8.1.1-ci0002-571668f 142 1/6/2026
8.1.0 146 1/5/2026
8.0.2 359 6/5/2025
8.0.1 271 6/4/2025
6.0.4 449 3/27/2023
Loading failed