BizDoc.Social.Slack 8.6.9

dotnet add package BizDoc.Social.Slack --version 8.6.9                
NuGet\Install-Package BizDoc.Social.Slack -Version 8.6.9                
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="BizDoc.Social.Slack" Version="8.6.9" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BizDoc.Social.Slack --version 8.6.9                
#r "nuget: BizDoc.Social.Slack, 8.6.9"                
#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.
// Install BizDoc.Social.Slack as a Cake Addin
#addin nuget:?package=BizDoc.Social.Slack&version=8.6.9

// Install BizDoc.Social.Slack as a Cake Tool
#tool nuget:?package=BizDoc.Social.Slack&version=8.6.9                

Slack for BizDoc

BizDoc enables to push messages into Slack, and responds to actions on messages in Slack.

To utilize Slack messaging, add the following 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 UseSocket options.

Remember to enable Socket Mode in app config, and use app-level token.

Responding to events

Developer can intercept Slack events within BizDoc, by setting the OnMessageReceived action.

builder.Services.AddBizDoc().
	AddSlack(..., e =>
		e.UseSocket(o =>
			o.OnMessageReceived = e => {
				if(e.Message is EventCallback ec && ec.Payload.Event is NewMessage msg)
					Debug.Write($"Message text '{msg.Text}'");
			}));
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

To notify the user in response, set the event Response property as follows.

	e.Response.Text = Markdown($"*{ctx.Document.Number}* success!");

Service

Inject SlackService service to take action in Slack.

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 change the format of 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 dataModel = e.Context.GetModel<MyFormModel>();
	
			var section = new Section("form_section");
			section.Fields.Add(new Text(dataModel.Title));
		
			e.Request.Blocks.Add(section);
		}
	});
Name Usage
OnMessagePost Outgoing message being sent. Cancelable.
OnMessageUpdate BizDoc update to Slack message on document update. Cancelable.
OnActionTaken Workflow resumed in BizDoc in response to user action taken in Slack.
OnNotify Notification, such as CubeAnomaly. Cancelable.

Block can be one of Section, ImageBlock, InputBlock, RichTextBlock or ActionsBlock, corresponding 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.

Set the ApplicationUrl option to provide Slack user a link to open BizDoc on browser.

Components

Components can be found in bizdoc.slack.json file added to BizDoc server root folder.

Flow node

SlackMessage, posts a message to Slack channel when workflow reaches the node.

Type source

Name Usage
Channels channels
Groups groups
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.6.9 84 12/5/2024
8.5.9 91 12/4/2024
8.5.8 82 12/2/2024
8.4.8 92 11/13/2024
8.4.7 103 7/29/2024
8.4.6 136 4/8/2024
8.4.5 132 2/2/2024
8.3.5 138 1/17/2024
8.3.4 119 1/12/2024
7.3.4 205 11/26/2023
7.3.3 131 11/20/2023
7.3.2 131 11/17/2023
7.2.2 149 9/26/2023
7.2.1 157 6/8/2023
7.2.0 142 5/22/2023
7.1.0 166 5/4/2023
7.0.0 333 11/28/2022
6.8.8 355 11/6/2022
6.8.6 364 10/31/2022
6.8.5 389 10/27/2022
6.8.3 399 10/24/2022
6.8.2 444 10/20/2022