Releases: soxtoby/SlackNet
v0.12.1
v0.12.0
ChatApi.PostEphemeral
correctly returnsPostEphemeralResponse
instead ofPostMessageResponse
.- Introduced
SlackNet.AzureFunctions
package to properly support running in Azure Functions.
Azure Functions
Hosting a SlackNet application in Azure Functions is now properly supported with the new SlackNet.AzureFunctions package. Configuration is similar to previous Azure Functions integration with SlackNet.AspNetCore, but the APIs have been simplified, and the isolated worker model is now supported. Additionally, some issues around the function shutting down before a request has finished being handled have been resolved, albeit at the cost of dropping support for early responses (responses will be sent after you've finished handling the request, no matter how early you respond). See the readme and AzureFunctionsExample project for more information.
Breaking changes
SlackNet.AspNetCore
VerifyWith
,UseSigningSecret
, andUseEventUrlVerification
, called insideUseSlackNet
, have been marked as obsolete, and will be removed in a future release. These calls should now be made inAddSlackNet
instead.- The callback in
AddSlackNet
now takes in anAspNetSlackServiceConfiguration
instead of aServiceCollectionSlackServiceConfiguration
. The API is otherwise compatible. Microsoft.AspNetCore.Http
andMicrosoft.AspNetCore.Http.Abstractions
dependencies have been bumped to versions 2.1.22 and 2.1.1 respectively.- The methods on
ISlackRequestHandler
no longer take in aSlackEndpointConfiguration
. The configuration is now injected into the implementation. SlackResult
no longer implementsIActionResult
.
Azure Functions
If you're currently using SlackNet.AspNetCore with Azure Functions, you'll need to switch to SlackNet.AzureFunctions, and make the following changes:
- Make sure you're configuring SlackNet with the
AddSlackNet
extension fromSlackNet.AzureFunctions
. - Move your
SlackEndpointConfiguration
configuration intoAddSlackNet
, and remove its service collection registration. - Replace the
ISlackRequestHandler
andSlackEndpointConfiguration
from your endpoints class with justISlackFunctionRequestHandler
, and update its usage to remove the second argument from each method call. - Change the return types of your function from
Task<SlackResult>
toTask<SlackFunctionResult>
.
See the AzureFunctionsExample project for an example.
Thankyou to @matthawley for his help with this release 💪
v0.11.5
v0.11.4
- Added
View
property toBlockOptionsRequest
. - Added
includeAllMetadata
parameter toIConversationsApi.History
.
Potentially breaking change
- If you were passing a
cursor
and/orCancellationToken
toIConversationsApi.History
as positional arguments, you'll need to either addfalse
as theincludeAllMetadata
argument, or specify thecursor
/cancellationToken
parameter names.
Thankyou to @nimoskov for his help with this release ✨
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 👍
v0.11.2
v0.11.1
- Added missing
IsExtSharedChannel
property toEventCallback
. - Incoming requests are logged when using
SlackNet.AspNetCore
. - Default ASP.NET logger logs with the specific SlackNet category (e.g.
SlackNet.Error
instead of justSlackNet
).
When using the default logger with ASP.NET, individual SlackNet log categories can be enabled in appsettings.json with:
"Logging": {
"LogLevel": {
"SlackNet.Data": "Trace",
"SlackNet.Serialization": "Trace",
"SlackNet.Internal": "Debug",
"SlackNet.Request": "Information",
"SlackNet.Error": "Error"
}
}
Setting a category to a higher level will filter out logs from that category.
v0.11.0
- Added the
UserHuddleChanged
,UserProfileChanged
, andUserStatusChanged
events. - Added logging for serialization. Useful for debugging serialization issues, but otherwise I'd recommend filtering out
LogEvent
s in theSerialization
category. - Added
Attachments
property toMessageSearchResult
. - Added
Unsafe
property toRichTextLink
. - Added
ThumbWidth
,ThumbHeight
,OriginalUrl
,ServiceName
, andServiceIcon
properties toAttachment
.
Breaking Changes
- Removed the stars API and associated classes. See this Slack announcement for more details.
Thankyou to @fstojanac for his help with this release 💪