v0.11.3
- Added optional
teamId
parameter toIConversationsApi.Create
. - Added support for message metadata.
- Added
MessageMetadataPosted
,MessageMetadataUpdated
, andMessageMetadataDeleted
events. - Added
BotId
,AppId
, andBotProfile
properties toMessageEvent
. - Added
TeamId
,Deleted
, andUpdated
properties toBotInfo
. - Added
RichTextInput
and fixed posting messages withRichTextBlock
s.
Metadata
When posting a message to Slack, you can specify the metadata in one of two ways:
await slack.Chat.PostMessage(new Message
{
Channel = "#general",
Text = "My message",
// Use your own metadata object. It will be serialized with the standard Slack conventions,
// and the event_type will be the name of the class in snake case.
MetadataObject = new MyMetadata("my info"),
// Specify the metadata JSON explicitly. This will take precedence over MetadataObject.
MetadataJson = new MessageMetadata
{
EventType = "my_metadata",
EventPayload = JToken.Parse("""{ "custom_info": "my info" }""") // Get your JToken from wherever you like
}
});
Messages retrieved from Slack will have a Metadata
property that contains the event type and JSON as a JToken
. To deserialize the JSON using the standard Slack JSON conventions, use the ToObject
method on MessageMetadata
, not the ToObject
method on JToken
:
var myMetadata = message.Metadata.ToObject<MyMetadata>();
Potentially breaking changes
- If you were passing a
CancellationToken
toIConversationsApi.Create
as a positional argument, you'll need to either addnull
as theteamId
argument, or specify thecancellationToken
parameter name. - Added a
SlackJsonSettings
parameter to theChatApi
constructor. If you're constructingChatApi
manually, you can pass inDefault.JsonSettings()
, or your own customized settings. - Pushed the
InitialValue
property ofTextInput
down to its sub-classes, to account forRichTextInput
's different type of value.
Thankyou to @jtsai-osa for his help with this release 👍