Closed rlightner closed 2 years ago
If you upgrade to 1.1.2 you'll get support for deriving from SlackMessageBase
and you'll be able to use your own implementation to add additional properties.
private sealed class ResponseTypeMessage : SlackMessageBase
{
public ResponseTypeMessage(IMessageBuilderContext context, string responseType) : base(context)
{
ResponseType = responseType;
}
[JsonPropertyName("response_type")]
public string ResponseType { get; }
}
public void CreateDerivedTypeMessage()
{
var builder = SlackMessageBuilder.CreateMessage<ResponseTypeMessage>(c => new ResponseTypeMessage(c, "in_channel"), "*Fallback*", isMarkdown: true)
.WithBlocks(b => b.AddHeaderBlock("Header Text"));
var responseTypeMessage = builder.Build();
var json = responseTypeMessage.ToJson();
}
Use case: Sending a message to a webhook, and need to specify the
response_type
and notchannel
is there a way to create a message where the content looks like this: