public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); NameValueCollection coll = HttpUtility.ParseQueryString(requestBody); var diceRoller = new DiceRoller(); List <string> diceRolls = diceRoller.CalculateRoll(coll["text"]); var myObj = new { response_type = "in_channel", text = $"<@" + coll["user_id"] + $"> roll results:", attachments = new object[] { new { text = string.Join("\n", diceRolls), color = "#36a64f", mrkdwn = true } } }; return(new OkObjectResult(myObj)); }