I have created a qna maker bot in Bot Framework v4 using c#, and now when there are no answers found in qna knowledge base, I have to call a waterfall dialog to ask some questions to the users.
How do I have to do this?
protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
{
var httpClient = _httpClientFactory.CreateClient();
var qnaMaker = new QnAMaker(new QnAMakerEndpoint
{
KnowledgeBaseId = _configuration["QnAKnowledgebaseId"],
EndpointKey = _configuration["QnAAuthKey"],
Host = GetHostname()
},
null,
httpClient);
_logger.LogInformation("Calling QnA Maker");
// The actual call to the QnA Maker service.
var response = await qnaMaker.GetAnswersAsync(turnContext);
if (response != null && response.Length > 0)
{
string message = GetMessage(response[0].Answer);
Attachment attachment = GetHeroCard(response[0].Answer);
await turnContext.SendActivityAsync(MessageFactory.Text(message), cancellationToken);
if (attachment != null)
await turnContext.SendActivityAsync(MessageFactory.Attachment(attachment), cancellationToken);
}
else
{
//HERE I WANT TO CALL WATERFALL DIALOG
//await turnContext.SendActivityAsync(MessageFactory.Text("No QnA Maker answers were found."), cancellationToken);
}
}