I have created a simple rule-based bot using Dialogs. And I added Cortana channel to my bot using bot framework.For that, I sign in with my personal outlook account that is used in registering in bot framework. I also have published my bot in Azure.But when I call the invocation name of the bot in Cortana it shows the bot and it is connected. But the problem is, it doesn't give the reply to my question. But I checked in bot framework emulator, the code is working and giving the proper reply.can anyone solve my problem?
using System;
using System.Threading.Tasks;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
namespace SuperheroesBot.Dialogs
{
[Serializable]
public class RootDialog : IDialog<object>
{
public Task StartAsync(IDialogContext context)
{
context.Wait(MessageReceivedAsync);
return Task.CompletedTask;
}
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<object> result)
{
var activity = await result as Activity;
string receiveMessage = activity.Text;
string returnMessage = "Hi How are you";
if (receiveMessage == "Yes Are you Ready")
{
returnMessage = "Yeah am ready";
}
else if (receiveMessage=="i am fine")
{
returnMessage = "nice you can ask me questions";
}
else if (receiveMessage=="what are the houses available now")
{
returnMessage = "Blue red green and yellow";
}
else if (receiveMessage == "who is going to win")
{
returnMessage = "i don't know. can u guess it";
}
else if (receiveMessage == "blue")
{
returnMessage = "alright.let's see";
}
await context.SayAsync(text: returnMessage, speak: returnMessage);
context.Wait(MessageReceivedAsync);
}
}
}
Check your device's region and language settings. They need to be set to USA for invoking a Cortana Skill's bot. See Microsoft Cortana Skills FAQ
-> there is a wait statement after the SayAsync() Be careful with wait statements. They throw errors after context.forward, context.call methods. Try if uncommenting the wait statement helps. Other than that no idea what might be the problem.