private async Task <DialogTurnResult> ActStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { if (!_luisRecognizer.IsConfigured) { // LUIS is not configured, we just run the BookingDialog path with an empty BookingDetailsInstance. await stepContext.Context.SendActivityAsync( MessageFactory.Text("NOTE: LUIS is not configured. To enable all capabilities, add 'LuisAppId', 'LuisAPIKey' and 'LuisAPIHostName' to the appsettings.json file.", inputHint: InputHints.IgnoringInput), cancellationToken); return(await stepContext.NextAsync(null, cancellationToken)); } // Call LUIS and gather any potential booking details. (Note the TurnContext has the response to the prompt.) var luisResult = await _luisRecognizer.Predict(stepContext.Context.Activity.Text); switch (luisResult.Prediction.TopIntent) { case "ModifyOrder": var pizzaOrder = PizzaOrder.Convert(luisResult.Prediction); var pizzaResponseText = PizzaOrder.GetPizzaOrderString(pizzaOrder); var responseCardAttachment = new HeroCard("Your order has been placed! ", null, pizzaResponseText, new List <CardImage>() { new CardImage(PizzaOrder.GetPizzaImage()) }).ToAttachment(); var chatActivity = Activity.CreateMessageActivity(); chatActivity.Attachments.Add(responseCardAttachment); await stepContext.Context.SendActivityAsync(chatActivity); break; case "Confirmation": var confirmationMessage = MessageFactory.Text("That's great! We'll get right on it", null, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(confirmationMessage, cancellationToken); break; case "CancelOrder": var cancelMessage = MessageFactory.Text("Your order has been cancelled!", null, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(cancelMessage, cancellationToken); break; case "Greetings": var greetingsMessage = MessageFactory.Text("Hello!", null, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(greetingsMessage, cancellationToken); break; default: // Catch all for unhandled intents var didntUnderstandMessageText = $"Sorry, I didn't get that. Please try asking in a different way (intent was {luisResult.Prediction.TopIntent})"; var didntUnderstandMessage = MessageFactory.Text(didntUnderstandMessageText, didntUnderstandMessageText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(didntUnderstandMessage, cancellationToken); break; } return(await stepContext.NextAsync(null, cancellationToken)); }