Example #1
0
        public async Task SendMessage(string webHook, SlackPayload payload)
        {
            var json          = JsonSerializer.Serialize(payload);
            var stringContent = new StringContent(json, Encoding.UTF8, "application/json");

            Client.BaseAddress = new Uri(webHook);
            await Client.PostAsync("", stringContent);
        }
Example #2
0
        public async Task Distribute(dynamic distributionElement)
        {
            string comicItemTitle = distributionElement.comicItem.Safe_Title;
            string imageLink      = distributionElement.comicItem.Img;

            var payload = new SlackPayload()
            {
                Text = $"{comicItemTitle} \n{imageLink}"
            };

            await _client.SendMessage(_options.Value.WebHook, payload);
        }