public override async Task Run() { var channel = ActivityUI.ChannelSelector.Value; var message = ActivityUI.MessageSource.TextValue; var success = await _slackIntegration.PostMessageToChat(AuthorizationToken.Token, channel, message).ConfigureAwait(false); if (!success) { throw new ActivityExecutionException("Failed to post message to Slack"); } }
public override async Task Run() { var actionChannelId = GetControl <DropDownList>("Selected_Slack_Channel")?.Value; if (string.IsNullOrEmpty(actionChannelId)) { RaiseError("No selected channelId found in activity."); } var messageField = GetControl <TextSource>("Select_Message_Field"); try { await _slackIntegration.PostMessageToChat(AuthorizationToken.Token, actionChannelId, StripHTML(messageField.TextValue)); } catch (AuthorizationTokenExpiredOrInvalidException) { RaiseInvalidTokenError(); } Success(); }