BizDoc.Core.Slack
6.5.7
See the version list below for details.
dotnet add package BizDoc.Core.Slack --version 6.5.7
NuGet\Install-Package BizDoc.Core.Slack -Version 6.5.7
<PackageReference Include="BizDoc.Core.Slack" Version="6.5.7" />
paket add BizDoc.Core.Slack --version 6.5.7
#r "nuget: BizDoc.Core.Slack, 6.5.7"
// Install BizDoc.Core.Slack as a Cake Addin #addin nuget:?package=BizDoc.Core.Slack&version=6.5.7 // Install BizDoc.Core.Slack as a Cake Tool #tool nuget:?package=BizDoc.Core.Slack&version=6.5.7
Slack for BizDoc
BizDoc pushes messages and notifications into Slack and responds to actions in Slack on messages.
To utilize Slack messaging, add in program.cs.
builder.Services.AddBizDoc().AddSlack(o => {
o.Token = "{token-here}";
o.ChannelId = "{channel-id-here}";
});
app.UseBizDoc().UseSlack();
Use app-level token.
Socket
To enable socket for background communication, call UseSocket().
builder.Services.AddBizDoc().AddSlack(o => { ... },
e => e.UseSocket());
You can configure ProxySettings on this option.
Remember to enable Socket Mode in app config.
Responding to events
builder.Services.AddBizDoc().
AddSlack(o => {
...
o.OnMessageReceived = e => {
if(e.Message is ChannelMessage cm && cm.Message is NewMessage msg)
Debug.Write($"Message text '{msg.Text}'");
}
});
You can notify the user by setting the event Response properties.
e.Response.Text = Markdown($"*{ctx.Document.Number}* success!");
Event | API |
---|---|
ChannelMessage | message |
ViewSubmission | |
ViewClosed | view_closed |
PresenceChange | |
UserChange | |
BlockActions | interactive, block_actions |
BlockSuggestion | interactive, block_suggestion |
SlashCommand | slash_commands |
TeamJoin | team_join |
Message types.
Type | Usage |
---|---|
NewMessage | |
MeMessage | |
BotMessage | |
MessageChanged | |
FileCreated | |
FileShared | |
FileCommentAdded | |
MessageReplied | |
MessageDeleted | |
ChannelLeave | |
ChannelJoin | |
ChannelCreated | |
AppHomeOpened | |
ThreadBroadcast |
Service
Inject SlackService
service.
Name | API | Usage |
---|---|---|
ListUsersAsync | users.list | List of User |
SearchMessagesAsync | search.messages | Query Message |
GetUserByEmailAsync | users.lookupByEmail | |
UploadFileAsync | files.uploadAsync or files.upload | |
ScheduleMessageAsync | chat.scheduleMessage | |
PostMessageAsync | chat.postMessage | |
PostEphemeralMessageAsync | chat.postEphemeral | |
UpdateMessageAsync | chat.update | |
DeleteMessageAsync | chat.delete | |
ListFilesAsync | files.list | |
ChannelsInviteAsync | channels.invite | |
ListConversationsAsync | conversations.list | |
SearchFilesAsync | search.files | |
PublishAppHomeTabAsync | views.publish | |
DeleteFileAsync | files.delete | |
CreateConversationAsync | conversations.create | |
ConversationInviteAsync | conversations.invite | |
ConversationKickAsync | conversations.kick | |
MarkConversationAsync | conversations.mark | |
CloseConversationAsync | conversations.close | |
LeaveConversationAsync | conversations.leave | |
GetUserInfoAsync | users.info |
Intercept outgoing messages
Implement the OnMessagePost option in AddSlack() to contribute an outgoing message.
Use the IDocumentContext
to access form model using the GetModel() method.
using BizDoc.Slack.Models;
builder.Services.AddBizDoc().AddSlack(o => {
...
o.OnMessagePost = e => {
var model = e.Context.GetModel<MyModel>();
var section = new Section("form_section");
section.Fields.Add(new Text(model.Title));
e.Request.Blocks.Add(section);
}
});
Block can be one of Section, Image, Input or Actions, which corresponds to Block Kit.
Element can be one of InputElement, DatePicker, Checkboxes, RadioButtons, Select, MultiSelect, ImageElement or Button. Use Text or Markdown to represent texts.
Product | Versions 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. |
-
- SlackAPI (>= 1.1.13)
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 | |
---|---|---|---|
6.8.2 | 882 | 10/18/2022 | |
6.7.0 | 801 | 7/10/2022 | |
6.6.2 | 766 | 6/15/2022 | |
6.6.1 | 816 | 6/9/2022 | |
6.6.0 | 767 | 5/31/2022 | |
6.5.12 | 786 | 5/20/2022 | |
6.5.11 | 827 | 5/16/2022 | |
6.5.9 | 795 | 5/15/2022 | |
6.5.8 | 759 | 5/11/2022 | |
6.5.7 | 765 | 5/11/2022 | |
6.5.6 | 816 | 5/10/2022 | |
6.5.5 | 792 | 5/10/2022 | |
6.5.4 | 788 | 5/10/2022 | |
6.5.3 | 783 | 5/9/2022 | |
6.5.2 | 787 | 5/9/2022 | |
6.5.1 | 779 | 4/6/2022 | |
6.3.5 | 801 | 2/7/2022 | |
6.3.3 | 798 | 1/30/2022 | |
6.3.2 | 838 | 1/27/2022 | |
6.3.1 | 828 | 1/24/2022 | |
6.2.0 | 796 | 1/11/2022 | |
6.0.1 | 664 | 12/20/2021 | |
6.0.0 | 662 | 11/10/2021 | |
5.3.1 | 706 | 11/3/2021 | |
5.3.0 | 857 | 10/30/2021 | |
5.1.1 | 710 | 8/30/2021 | |
5.1.0 | 718 | 8/23/2021 |