Example #1
0
        public Task <SwaggerResponse> SendSlackAsync(MailDto slackMessage)
        {
            var headers = new Dictionary <string, IEnumerable <string> >();

            try
            {
                var userId  = _httpContextAccessor.HttpContext.User.FindFirst(cl => cl.Type.Equals("id")).Value;
                var profile = _unitOfWork.AppProfiles.FindById(userId);
                _slackClient.SetConfig(_slackConfigOptions);
                _slackClient.PostMessage($"From {profile.Identity.Email}: {slackMessage.Subject} {slackMessage.Body}");
                return(Task.Run(() => new SwaggerResponse(StatusCodes.Status200OK, headers)));
            }
            catch (Exception exception)
            {
                return(HandleException(exception, headers));
            }
        }