SlackMessageBuilder.NewtonsoftJson
SlackMessageBuilder.SystemTextJson
A fluent style builder for creating Slack Messages. Supports both legacy Attachments and Block Kit. Fully documented with details from the Slack API reference.
Separate packages for System.Text.Json and Newtonsoft.Json
Example
var builder = SlackMessageBuilder.CreateApiMessage("my-channel", "*Some fallback text*", isMarkdown: true)
.WithBlocks(blockBuilder => blockBuilder
.AddHeaderBlock("Header Text")
.AddContextBlock(contextBuilder =>
{
contextBuilder.AddImage("https://url-to-image", "alt-text");
contextBuilder.AddMarkdown("*Do you like my image?*");
})
.AddImageBlock("https://url-to-big-image", title: "Big Image Title")
.AddDividerBlock()
.AddMarkdownSectionBlock("A markdown section block"));
var message = builder.Build();
var json = message.ToJson();- Block Kit Builder You can use this website to preview the json output.