Exemple #1
0
        public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser,
                                              IDTSComponentEvents componentEvents, IDTSLogging log, object transaction)
        {
            try
            {
                var client  = new SlackClient();
                var message = new SlackMessage();
                message.Text        = this.Text;
                message.Username    = this.User;
                message.Attachments = Attachments.ToArray();

                this.SlackMessageJson = SlackClient.ConvertToSlackMessage(message);

                client.SendMessage(message, this.WebHookUrl);
            }
            catch (Exception e)
            {
                componentEvents.FireError(0, "Slact Taks", "Error sending message to Slack. Webhook = " + WebHookUrl, "", 0);
            }

            //Always retun sucess because we do not want to fail package if we cannot send message to Slack
            //TODO: Should this be a setting?
            return(DTSExecResult.Success);
        }