I am trying to get different message from same intent. Let us consider that i have a intent Greeting , so when user say 'Hi' to Bot then bot call the Greeting intent then bot show the message "hello and welcome" to the user.
If you say Hi again to the bot then i want the different message from the bot like "hello and welcome again".
here is my intent code
new OnIntent("Greeting")
{
Actions = new List<Dialog>()
{
new CodeAction(async (dialogContext, options) =>
{
var now = DateTime.Now.TimeOfDay;
var time = now < new TimeSpan(12, 0, 0)
? "morning"
: now > new TimeSpan(19, 0, 0)
? "evening"
: "afternoon";
dialogContext.State.SetValue("dialog.greetingTime", time);
dialogContext.State.SetValue("user.name",CustmerName);
return await dialogContext.EndDialogAsync(options);
}),
new SendActivity("${HelpRootDialog()}")
}
},
You can make use of conversation state. Add a boolean field called isUserGreeted, when the intent is hit for the first time, set it as true.
When the intent is hit again, check the conversation state to see if the user was already greeted, if yes you can send the user the second hello message.
If you want to reset the greeted flag based on a date, you can also store the date information to see if the user was greeted today.