v0.7.0
- Added global shortcut support.
- Fixed an issue deserializing large requests.
- More consistent handler registration.
- Added ability to replace the root handlers.
- Simplified Azure Functions integration a little.
- Experimental early-response API.
Breaking Changes
MessageAction
,IMessageActionHandler
, andRegisterMessageActionHandler
have been renamed toMessageShortcut
,IMessageShortcutHandler
, andRegisterMessageShortcutHandler
respectively, to match Slack's new terminology. The old types & methods are still available, but have been marked asObsolete
.- All the base handler registration classes (e.g.
SlackEvents
andSlackBlockActions
) have been removed. If you were using any of these, I'd recommend just copying their old code - they were pretty simple.- If you were relying on the
IObservable
s exposed bySlackEvents
, and you're using SlackNet.AspNetCore, you can injectIEventsObservables
, which exposes the same observables.
- If you were relying on the
RegisterDialogSubmissionHandler
now takes in acallbackId
, so you can register different handlers for different dialogs. If you want the old behavior where one handler is used for all dialogs, useReplaceLegacyDialogSubmissionHandling
instead. Note that this is for Slack's old dialogs - I'd recommend moving to modal views going forward.SlackResponse
has been renamed toSlackResult
, and now implementsIActionResult
.- SlackNet.AspNetCore now depends on Microsoft.AspNetCore.Mvc.Abstractions, which you're probably already depending on.
- If you're using SlackNet.AspNetCore with Azure Functions, I'd recommend copying the updated SlackEndpoints example - it's much simpler now.
Experimental early-response API
A common issue with the current handler API is that SlackNet waits for all of the handlers' work to complete before responding to Slack, which doesn't wait very long before showing errors in the UI. This release includes an experimental API for responding to Slack before completing all the work a handler performs. This lets you implement a handler like this:
public Task Handle(SlashCommand command, Responder<SlashCommandResponse> respond)
{
// Provides feedback as quickly as possible
await respond(new SlashCommandResponse { Message = new Message {
Text = "Command received" } });
// Posts more information once it's available
var info = await FetchSomeInfoFromARemoteService();
await _slackApi.Chat.PostMessage(new Message {
Text = $"Here's what you asked for: {info}" });
}
These new handler types can be registered with the RegisterAsync*
methods available inside the configuration callback of AddSlackNet()
. Work performed after responding should probably still be kept fairly short, in the order of seconds. If you want to perform longer operations, it's probably best to do it in a background thread.
Please give this a go and provide feedback in the early-response feedback issue.