Skip to content

Commit 3e0212c

Browse files
committed
Adds docs link
1 parent dfc5234 commit 3e0212c

File tree

1 file changed

+2
-86
lines changed

1 file changed

+2
-86
lines changed

readme.md

Lines changed: 2 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -10,90 +10,6 @@ An opinionated ASP.NET Core middleware to create simple Slackbots using the Slac
1010
### Install
1111
Download it from NuGet:[![NuGet](https://img.shields.io/nuget/dt/slackbot.net.endpoints.svg)](https://www.nuget.org/packages/slackbot.net.endpoints/)
1212

13-
`$ dotnet add package slackbot.net.endpoints`
13+
### Docs
1414

15-
### Supported events
16-
- `challenge`
17-
- `app_mention`
18-
- `view_submission`
19-
- `member_joined_channel`
20-
21-
22-
23-
## Configuration
24-
25-
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.
26-
### Single workspace Slack app
27-
28-
29-
```csharp
30-
var builder = WebApplication.CreateBuilder(args);
31-
32-
// Needed to verify that incoming event payloads are from Slack
33-
builder.Services.AddAuthentication()
34-
.AddSlackbotEvents(c =>
35-
c.SigningSecret = Environment.GetEnvironmentVariable("SIGNING_SECRET")
36-
);
37-
38-
// Setup event handlers
39-
builder.Services.AddSlackBotEvents()
40-
.AddAppMentionHandler<DoStuff>()
41-
42-
43-
var app = builder.Build();
44-
app.UseSlackbot(); // event endpoint
45-
app.Run();
46-
47-
class DoStuff : IHandleAppMentions
48-
{
49-
public bool ShouldHandle(AppMentionEvent slackEvent) => slackEvent.Text.Contains("hi");
50-
51-
public Task<EventHandledResponse> Handle(EventMetaData meta, AppMentionEvent @evt)
52-
{
53-
Console.WriteLine("Doing stuff!");
54-
return Task.FromResult(new EventHandledResponse("yolo"));
55-
}
56-
}
57-
```
58-
59-
### Advanced: Distributed Slack app
60-
61-
Implement the `ITokenStore` to store/remote on install/uninstall flows.
62-
63-
```csharp
64-
var builder = WebApplication.CreateBuilder(args);
65-
66-
// Needed to verify that incoming event payloads are from Slack
67-
builder.Services.AddAuthentication()
68-
.AddSlackbotEvents(c => c.
69-
SigningSecret = Environment.GetEnvironmentVariable("SIGNING_SECRET")
70-
);
71-
72-
builder.Services.AddSlackbotDistribution(c => {
73-
c.CLIENT_ID = Environment.GetEnvironmentVariable("CLIENT_ID");
74-
c.CLIENT_SECRET = Environment.GetEnvironmentVariable("CLIENT_SECRET");
75-
});
76-
77-
// Setup event handlers
78-
builder.Services.AddSlackBotEvents<MyTokenStore>()
79-
.AddAppMentionHandler<DoStuff>()
80-
81-
82-
var app = builder.Build();
83-
app.Map("/authorize", a => a.UseSlackbotDistribution()); // OAuth callback endpoint
84-
app.Map("/events", a => a.UseSlackbot()); // event endpoint
85-
app.Run();
86-
87-
88-
/// Bring-your-own-token-store:
89-
class MyTokenStore : ITokenStore
90-
{
91-
// _db is some persistance technology you choose (sql, mongo, whatever)
92-
public Task<Workspace Delete(string teamId) => _db.DeleteByTeamId(teamId);
93-
public Task Insert(Workspace slackTeam) => _db.Insert(slackTeam);
94-
}
95-
```
96-
97-
### Samples
98-
99-
Check the [samples](/Samples/).
15+
Check the docs: https://slackbot-net.vercel.app/

0 commit comments

Comments
 (0)