Example #1
0
        private async Task SendNotification(string type, string message, string sender = null)
        {
            var webHookUrl = _slackIntegrationSettings.GetChannelWebHook(type);

            if (webHookUrl == null)
            {
                return;
            }

            var text = new StringBuilder();

            if (!string.IsNullOrEmpty(_slackIntegrationSettings.Env))
            {
                text.AppendLine($"Environment: {_slackIntegrationSettings.Env}");
            }

            text.AppendLine(sender != null ? $"{sender} : {message}" : message);

            await HttpRequestClient.PostRequestAsync(webHookUrl, new { text = text.ToString() }.ToJson());
        }