public Task VacancyManuallyClosed(Vacancy vacancy)
        {
            var messageBody = string.Format($"Vacancy VAC{vacancy.VacancyReference} has been closed ({vacancy.OwnerType.ToString()})");

            var message = new SlackMessage {
                Text = messageBody
            };

            return(_slackClient.PostAsync(message, SlackVacancyNotificationType.ManuallyClosed));
        }
        public Task VacancyReviewCreated(VacancyReview vacancyReview)
        {
            var messageBody = $"Vacancy VAC{vacancyReview.VacancyReference} is ready for review ({vacancyReview.VacancySnapshot.OwnerType.ToString()})";

            if (vacancyReview.SubmissionCount > 1)
            {
                messageBody += $" ({GetNumericSuffix(vacancyReview.SubmissionCount)} submission)";
            }

            var message = new SlackMessage {
                Text = messageBody
            };

            return(_slackClient.PostAsync(message, SlackVacancyNotificationType.New));
        }
 public async Task Run()
 {
     await slackApi.PostAsync(new SlackMessage
     {
         Channel   = this.config.SlackConfig.Channel,
         Username  = "******",
         IconEmoji = Emoji.ForkAndKnife,
         Text      = ":mega: <!channel> Please order your Apetito menu until 11:00 via <https://www.mylunch-apetito.de>",
     });
 }
        public async Task Run(DateTime?date = null)
        {
            date = date ?? DateTime.Today;
            Order[] guests = await this.apetitoApi.GetOrders(date?.ToString("yyyy-MM-dd"));

            foreach (var message in CreateMessagesForGuests(guests))
            {
                await slackApi.PostAsync(message);
            }
        }
        private async Task <bool> SendMessage(Message message)
        {
            var slackMessage = new SlackMessage
            {
                Channel   = this.configuration.SlackChannel,
                Username  = this.configuration.SlackUserName,
                IconEmoji = ":email:",
                Text      = $"Отловленное событие: {message.Title} {message.ChangedDate} {message.Uri}"
            };


            var response = await client.PostAsync(slackMessage);

            return(response.ResponseStatus == ResponseStatus.Completed);
        }
    public async Task Send(string message, Uri link, IReadOnlyCollection <string> tags)
    {
        try
        {
            var slackMessage = new SlackMessage
            {
                Channel   = "#general",
                IconEmoji = Emoji.Newspaper,
                Text      = message,
                Blocks    = new List <Block>
                {
                    new Header()
                    {
                        Text = new TextObject($"Новости")
                    },
                    new Section
                    {
                        Text = new TextObject($":newspaper: {message}")
                        {
                            Emoji = true,
                            Type  = TextObject.TextType.PlainText
                        }
                    },
                    new Divider(),
                    new Section
                    {
                        Text = new TextObject($"Узнать подробности: <{link}>")
                        {
                            Type = TextObject.TextType.Markdown, Verbatim = false
                        }
                    }
                },
            };

            await _client.PostAsync(slackMessage);

            _logger.LogInformation($"Message was sent to Slack");
        }
        catch (Exception ex)
        {
            _logger.LogError(ex, $"Error during send message to Slack");
        }
    }