public static async Task Run()

in Source/Function/EnrollmentVerificator.cs [264:306]


        public static async Task<System.Net.Http.HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post")]HttpRequest req,
            [Table("CustomerInformation", Connection = "AzureWebJobsStorage")] CloudTable table,
            [OrchestrationClient] DurableOrchestrationClient client,
            ILogger log)
        {
            string responseSMS = string.Empty;
            string dataRaw = req.Form[Form.Body];
            string fromRaw = req.Form[Form.From];

            var response = dataRaw.Trim().ToLower();
            var phoneMumber = fromRaw.Trim();

            var result = await table.GetItemsAsync<CustomerInfo>(phoneMumber);
            var customerInfofromTable = result.FirstOrDefault();

            log.LogInformation($"User with phone number: {customerInfofromTable.Phonenumber} has sent back a SMS message response with the following content: {response}");

            responseSMS = "Thank you for answering. Your request is being processed";
            if (response == TwilioSMS.Response.Accepted || response == TwilioSMS.Response.Yes)
            {
                await client.RaiseEventAsync(customerInfofromTable.InstanceId, Events.ApprovalEvent, EnrollmentStatusEnum.Accepted);
            }
            else if (response == TwilioSMS.Response.Cancelled || response == TwilioSMS.Response.No)
            {
                await client.RaiseEventAsync(customerInfofromTable.InstanceId, Events.ApprovalEvent, EnrollmentStatusEnum.Rejected);
            }
            else
            {
                responseSMS = "I could not understand you! Please, reply with YES/ACCEPTED or NO/CANCELLED";
            }            

            var twilioMsg = new Twilio.TwiML.MessagingResponse()
                .Message(responseSMS);

            var twiml = twilioMsg.ToString();
            twiml = twiml.Replace("utf-16", "utf-8");

            return new System.Net.Http.HttpResponseMessage
            {
                Content = new System.Net.Http.StringContent(twiml, System.Text.Encoding.UTF8, "application/xml")
            };
        }