예제 #1
0
        public string Handle(string input)
        {
            FormResponse formResponse = JsonConvert.DeserializeObject <FormResponse>(input);

            var message   = FormatMessage(formResponse);
            var slackSent = SendToSlack(message);

            var fnResponse = $"Response recorded from {formResponse.Email}. Slack posted? {slackSent}";

            return(fnResponse);
        }
예제 #2
0
        private string FormatMessage(FormResponse response)
        {
            var msg = new StringBuilder();

            msg.Append($"{response.FirstName} {response.LastName} would like to join the Slack group!");
            if (!string.IsNullOrWhiteSpace(response.Company))
            {
                msg.Append($"\nThey work at {response.Company}.");
            }
            if (!string.IsNullOrWhiteSpace(response.Location))
            {
                msg.Append($"\nThey say they're from {response.Location}");
            }
            msg.Append($"\nThe reason they'd like to join is to {response.JoinReason}");
            msg.Append($"\nSend them an invite link to {response.Email}");

            return(msg.ToString());
        }