BizDoc.Core.Slack
6.8.2
dotnet add package BizDoc.Core.Slack --version 6.8.2
NuGet\Install-Package BizDoc.Core.Slack -Version 6.8.2
<PackageReference Include="BizDoc.Core.Slack" Version="6.8.2" />
paket add BizDoc.Core.Slack --version 6.8.2
#r "nuget: BizDoc.Core.Slack, 6.8.2"
// Install BizDoc.Core.Slack as a Cake Addin #addin nuget:?package=BizDoc.Core.Slack&version=6.8.2 // Install BizDoc.Core.Slack as a Cake Tool #tool nuget:?package=BizDoc.Core.Slack&version=6.8.2
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 = "{bot-oauth-token}";
o.ChannelId = e => "{channel-id}";
});
app.UseBizDoc().UseSlack();
Sockets
To enable socket for background communication, call UseSocket().
builder.Services.AddBizDoc().AddSlack(o => ...,
e => e.UseSocket(o => {
Token = "{app-level-token}";
}));
You can configure ProxySettings and retry policy on this option.
Remember to enable Socket Mode in app config. Use app-level token.
Responding to events
builder.Services.AddBizDoc().
AddSlack(..., e =>
e.UseSocket(o =>
o.OnMessageReceived = e => {
if(e.Message is EventCallback em && em.Payload.Event is NewMessage msg)
Debug.Write($"Message text '{msg.Text}'");
}));
You can notify the user by setting the event Response property.
e.Response.Text = Markdown($"*{ctx.Document.Number}* success!");
Event | API | Usage |
---|---|---|
BlockActions | interactive, block_actions | |
ViewSubmission | interactive, view_submission | |
BlockSuggestion | interactive, block_suggestion | |
ViewClosed | view_closed | |
EventCallback | event_callback | |
Shortcut | shortcut | |
MessageAction | message_action | |
SlashCommand | slash_commands | |
AppHomeOpened | app_home_opened |
Events.
Type | API |
---|---|
TeamJoin | team_join |
NewMessage | message |
PresenceChange | presence_change |
ChannelCreated | channel_created |
ChannelJoined | channel_joined |
FileCreated | file_created |
FileShared | file_shared |
FileCommentAdded | file_comment_added |
UserChange | user_change |
Message
types.
Type | API |
---|---|
NewMessage | message |
MeMessage | me_message |
BotMessage | bot_message |
MessageChanged | message_changed |
FileShare | file_share |
GroupJoin | group_join |
GroupLeave | group_leave |
FileCommentAdded | file_comment |
MessageReplied | message_replied |
MessageDeleted | message_deleted |
ChannelLeave | channel_leave |
ChannelJoin | channel_join |
ThreadBroadcast | thread_broadcast |
Service
Inject SlackService
service.
await _slackService.PostMessageAsync("channel-id", "Message!");
Name | API | Usage |
---|---|---|
ListUsersAsync | users.list | List of User |
PostMessageAsync | chat.postMessage | |
PostEphemeralMessageAsync | chat.postEphemeral | |
ScheduleMessageAsync | chat.scheduleMessage | |
UpdateMessageAsync | chat.update | |
DeleteMessageAsync | chat.delete | |
UploadFileAsync | files.uploadAsync or files.upload | |
GetFileInfoAsync | files.info | |
ListFilesAsync | files.list | |
DeleteFileAsync | files.delete | |
OpenViewAsync | views.open | |
UpdateViewAsync | views.update | |
SearchFilesAsync | search.files | |
PublishAppHomeTabAsync | views.publish | |
ListConversationsAsync | conversations.list | |
CreateConversationAsync | conversations.create | |
ConversationInviteAsync | conversations.invite | |
ConversationKickAsync | conversations.kick | |
MarkConversationAsync | conversations.mark | |
CloseConversationAsync | conversations.close | |
LeaveConversationAsync | conversations.leave | |
SearchMessagesAsync | search.messages | Query Message |
GetUserInfoAsync | users.info | |
GetUserByEmailAsync | users.lookupByEmail |
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(o => {
o.ApplicationUrl = "{server-public-address}";
}).
AddSlack(o => {
...
o.OnMessagePost = e => {
var formModel = e.Context.GetModel<MyFormModel>();
var section = new Section("form_section");
section.Fields.Add(new Text(formModel.Title));
e.Request.Blocks.Add(section);
}
});
Name | Usage |
---|---|
OnMessagePost | Outgoing message being sent. Cancelable. |
OnMessageUpdate | BizDoc update to Slack message on document update. Canelable. |
OnActionTaken | User taken action on Slack and workflow was resumed in BizDoc. |
OnNotify | Notification, such as CubeAnomaly. Canelable. |
Block can be one of Section, ImageBlock, InputBlock, RichTextBlock or ActionsBlock, which corresponds to Block Kit.
Element can be one of Input, DatePicker, Checkboxes, RadioButtons, Select, MultiSelect, Image, OverflowMenu, Button, ConversationsSelect, MultiConversationsSelect, ChannelsSelect or MultiChannelsSelect.
Use Text or Markdown to represent texts.
Commonly use Section, and Button as section Accessory for interaction.
The ApplicationUrl is used to provide the Slack user links back to BizDoc.
Components
Components can be found in bizdoc.slack.json file.
Flow node
SlackMessge.
Post a message in a channel when workflow reaches the node.
Type source
Name | Usage |
---|---|
Channels | channels |
Groups | groups |
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. |
-
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 | |
---|---|---|---|
6.8.2 | 889 | 10/18/2022 | |
6.7.0 | 807 | 7/10/2022 | |
6.6.2 | 772 | 6/15/2022 | |
6.6.1 | 822 | 6/9/2022 | |
6.6.0 | 773 | 5/31/2022 | |
6.5.12 | 792 | 5/20/2022 | |
6.5.11 | 833 | 5/16/2022 | |
6.5.9 | 801 | 5/15/2022 | |
6.5.8 | 765 | 5/11/2022 | |
6.5.7 | 771 | 5/11/2022 | |
6.5.6 | 824 | 5/10/2022 | |
6.5.5 | 798 | 5/10/2022 | |
6.5.4 | 794 | 5/10/2022 | |
6.5.3 | 789 | 5/9/2022 | |
6.5.2 | 793 | 5/9/2022 | |
6.5.1 | 785 | 4/6/2022 | |
6.3.5 | 807 | 2/7/2022 | |
6.3.3 | 804 | 1/30/2022 | |
6.3.2 | 844 | 1/27/2022 | |
6.3.1 | 834 | 1/24/2022 | |
6.2.0 | 802 | 1/11/2022 | |
6.0.1 | 670 | 12/20/2021 | |
6.0.0 | 668 | 11/10/2021 | |
5.3.1 | 712 | 11/3/2021 | |
5.3.0 | 863 | 10/30/2021 | |
5.1.1 | 716 | 8/30/2021 | |
5.1.0 | 724 | 8/23/2021 |