public async Task <IActionResult> Execute([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log) { try { var request = await req.ReadSlackRequest(); if (string.IsNullOrWhiteSpace(request.Text)) { return(SlackResponse.NoLocationProvided().AsJson()); } var location = new LocationFromRequest(request.Text); var totalAvailableSeats = _locations.TotalCapacityOf(location); var filledSeats = _capacityService.NumberOfDesksOccupiedForLocation(location); var result = $"There are {filledSeats} of {totalAvailableSeats} desks used in {request.Text}."; var imageUrl = _urlHelper.CapacityImageFor(location); return(new SlackResponse(result, imageUrl).AsJson()); } catch (Exception ex) { log.LogError(ex.ToString()); throw; } }