Repository navigation
v0.11.3
- Added optional
teamIdparameter toIConversationsApi.Create. - Added support for message metadata.
- Added
MessageMetadataPosted,MessageMetadataUpdated, andMessageMetadataDeletedevents. - Added
BotId,AppId, andBotProfileproperties toMessageEvent. - Added
TeamId,Deleted, andUpdatedproperties toBotInfo. - Added
RichTextInputand fixed posting messages withRichTextBlocks.
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
CancellationTokentoIConversationsApi.Createas a positional argument, you'll need to either addnullas theteamIdargument, or specify thecancellationTokenparameter name. - Added a
SlackJsonSettingsparameter to theChatApiconstructor. If you're constructingChatApimanually, you can pass inDefault.JsonSettings(), or your own customized settings. - Pushed the
InitialValueproperty ofTextInputdown to its sub-classes, to account forRichTextInput's different type of value.
Thankyou to @jtsai-osa for his help with this release 👍