Routing using Activity.text in Microsoft Bot Framework [duplicate]
This question already has an answer here:
Bot Framework Dialog Leakage Issue
1 answer
I know there are other ways of chaining Dialogs in Microsoft Bot Framework but I am trying to understand why I cannot route to Dialogs using the Activity text.
Can someone shed so light on it, please? I am possibly overlooking something stupid because I am running on caffeine at the moment
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.Type == ActivityTypes.Message)
{
if (activity.Text == "Hello")
{
await Conversation.SendAsync(activity, () => new Dialogs.HelloDialog());
}
else
{
await Conversation.SendAsync(activity, () => new Dialogs.RootDialog());
}
}
else
{
HandleSystemMessage(activity);
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
}
c# botframework
marked as duplicate by Community♦ Nov 15 '18 at 17:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Bot Framework Dialog Leakage Issue
1 answer
I know there are other ways of chaining Dialogs in Microsoft Bot Framework but I am trying to understand why I cannot route to Dialogs using the Activity text.
Can someone shed so light on it, please? I am possibly overlooking something stupid because I am running on caffeine at the moment
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.Type == ActivityTypes.Message)
{
if (activity.Text == "Hello")
{
await Conversation.SendAsync(activity, () => new Dialogs.HelloDialog());
}
else
{
await Conversation.SendAsync(activity, () => new Dialogs.RootDialog());
}
}
else
{
HandleSystemMessage(activity);
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
}
c# botframework
marked as duplicate by Community♦ Nov 15 '18 at 17:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Bot Framework Dialog Leakage Issue
1 answer
I know there are other ways of chaining Dialogs in Microsoft Bot Framework but I am trying to understand why I cannot route to Dialogs using the Activity text.
Can someone shed so light on it, please? I am possibly overlooking something stupid because I am running on caffeine at the moment
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.Type == ActivityTypes.Message)
{
if (activity.Text == "Hello")
{
await Conversation.SendAsync(activity, () => new Dialogs.HelloDialog());
}
else
{
await Conversation.SendAsync(activity, () => new Dialogs.RootDialog());
}
}
else
{
HandleSystemMessage(activity);
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
}
c# botframework
This question already has an answer here:
Bot Framework Dialog Leakage Issue
1 answer
I know there are other ways of chaining Dialogs in Microsoft Bot Framework but I am trying to understand why I cannot route to Dialogs using the Activity text.
Can someone shed so light on it, please? I am possibly overlooking something stupid because I am running on caffeine at the moment
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.Type == ActivityTypes.Message)
{
if (activity.Text == "Hello")
{
await Conversation.SendAsync(activity, () => new Dialogs.HelloDialog());
}
else
{
await Conversation.SendAsync(activity, () => new Dialogs.RootDialog());
}
}
else
{
HandleSystemMessage(activity);
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
}
This question already has an answer here:
Bot Framework Dialog Leakage Issue
1 answer
c# botframework
c# botframework
asked Nov 13 '18 at 9:10
Shaun VermaakShaun Vermaak
20218
20218
marked as duplicate by Community♦ Nov 15 '18 at 17:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Community♦ Nov 15 '18 at 17:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I've marked this as a duplicate of Bot Framework Dialog Leakage Issue because it relates to the same basic misunderstanding. Conversation.SendAsync
doesn't forward a message to the dialog you've specified, it just sends the message to the conversation which automatically uses whatever dialog is on top of the stack. Here's the relevant piece of my answer to the other question:
I think you may be misunderstanding the purpose of
Conversation.SendAsync()
. The MakeRoot delegate isn't a
function to navigate to whatever dialog you want. It's only called at
the start of the conversation and it's used to create the
conversation's root dialog. If a conversation is already underway,
Conversation.SendAsync()
sends the activity to whatever dialog is on
top of the stack and the MakeRoot delegate is ignored. You can read
more about dialogs and conversation flow here:
https://docs.microsoft.com/en-us/azure/bot-service/bot-service-design-conversation-flow?view=azure-bot-service-3.0
If you want to start a dialog in the middle of a conversation you
should do it from within another dialog and not from your messages
controller. A typical way of doing this is to usecontext.Forward()
:
https://docs.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-manage-conversation-flow?view=azure-bot-service-3.0#invoke-the-new-order-dialog
1
Thank you Kyle. That explains it perfectly
– Shaun Vermaak
Nov 15 '18 at 9:14
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I've marked this as a duplicate of Bot Framework Dialog Leakage Issue because it relates to the same basic misunderstanding. Conversation.SendAsync
doesn't forward a message to the dialog you've specified, it just sends the message to the conversation which automatically uses whatever dialog is on top of the stack. Here's the relevant piece of my answer to the other question:
I think you may be misunderstanding the purpose of
Conversation.SendAsync()
. The MakeRoot delegate isn't a
function to navigate to whatever dialog you want. It's only called at
the start of the conversation and it's used to create the
conversation's root dialog. If a conversation is already underway,
Conversation.SendAsync()
sends the activity to whatever dialog is on
top of the stack and the MakeRoot delegate is ignored. You can read
more about dialogs and conversation flow here:
https://docs.microsoft.com/en-us/azure/bot-service/bot-service-design-conversation-flow?view=azure-bot-service-3.0
If you want to start a dialog in the middle of a conversation you
should do it from within another dialog and not from your messages
controller. A typical way of doing this is to usecontext.Forward()
:
https://docs.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-manage-conversation-flow?view=azure-bot-service-3.0#invoke-the-new-order-dialog
1
Thank you Kyle. That explains it perfectly
– Shaun Vermaak
Nov 15 '18 at 9:14
add a comment |
I've marked this as a duplicate of Bot Framework Dialog Leakage Issue because it relates to the same basic misunderstanding. Conversation.SendAsync
doesn't forward a message to the dialog you've specified, it just sends the message to the conversation which automatically uses whatever dialog is on top of the stack. Here's the relevant piece of my answer to the other question:
I think you may be misunderstanding the purpose of
Conversation.SendAsync()
. The MakeRoot delegate isn't a
function to navigate to whatever dialog you want. It's only called at
the start of the conversation and it's used to create the
conversation's root dialog. If a conversation is already underway,
Conversation.SendAsync()
sends the activity to whatever dialog is on
top of the stack and the MakeRoot delegate is ignored. You can read
more about dialogs and conversation flow here:
https://docs.microsoft.com/en-us/azure/bot-service/bot-service-design-conversation-flow?view=azure-bot-service-3.0
If you want to start a dialog in the middle of a conversation you
should do it from within another dialog and not from your messages
controller. A typical way of doing this is to usecontext.Forward()
:
https://docs.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-manage-conversation-flow?view=azure-bot-service-3.0#invoke-the-new-order-dialog
1
Thank you Kyle. That explains it perfectly
– Shaun Vermaak
Nov 15 '18 at 9:14
add a comment |
I've marked this as a duplicate of Bot Framework Dialog Leakage Issue because it relates to the same basic misunderstanding. Conversation.SendAsync
doesn't forward a message to the dialog you've specified, it just sends the message to the conversation which automatically uses whatever dialog is on top of the stack. Here's the relevant piece of my answer to the other question:
I think you may be misunderstanding the purpose of
Conversation.SendAsync()
. The MakeRoot delegate isn't a
function to navigate to whatever dialog you want. It's only called at
the start of the conversation and it's used to create the
conversation's root dialog. If a conversation is already underway,
Conversation.SendAsync()
sends the activity to whatever dialog is on
top of the stack and the MakeRoot delegate is ignored. You can read
more about dialogs and conversation flow here:
https://docs.microsoft.com/en-us/azure/bot-service/bot-service-design-conversation-flow?view=azure-bot-service-3.0
If you want to start a dialog in the middle of a conversation you
should do it from within another dialog and not from your messages
controller. A typical way of doing this is to usecontext.Forward()
:
https://docs.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-manage-conversation-flow?view=azure-bot-service-3.0#invoke-the-new-order-dialog
I've marked this as a duplicate of Bot Framework Dialog Leakage Issue because it relates to the same basic misunderstanding. Conversation.SendAsync
doesn't forward a message to the dialog you've specified, it just sends the message to the conversation which automatically uses whatever dialog is on top of the stack. Here's the relevant piece of my answer to the other question:
I think you may be misunderstanding the purpose of
Conversation.SendAsync()
. The MakeRoot delegate isn't a
function to navigate to whatever dialog you want. It's only called at
the start of the conversation and it's used to create the
conversation's root dialog. If a conversation is already underway,
Conversation.SendAsync()
sends the activity to whatever dialog is on
top of the stack and the MakeRoot delegate is ignored. You can read
more about dialogs and conversation flow here:
https://docs.microsoft.com/en-us/azure/bot-service/bot-service-design-conversation-flow?view=azure-bot-service-3.0
If you want to start a dialog in the middle of a conversation you
should do it from within another dialog and not from your messages
controller. A typical way of doing this is to usecontext.Forward()
:
https://docs.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-manage-conversation-flow?view=azure-bot-service-3.0#invoke-the-new-order-dialog
answered Nov 13 '18 at 18:40
Kyle DelaneyKyle Delaney
1,59831026
1,59831026
1
Thank you Kyle. That explains it perfectly
– Shaun Vermaak
Nov 15 '18 at 9:14
add a comment |
1
Thank you Kyle. That explains it perfectly
– Shaun Vermaak
Nov 15 '18 at 9:14
1
1
Thank you Kyle. That explains it perfectly
– Shaun Vermaak
Nov 15 '18 at 9:14
Thank you Kyle. That explains it perfectly
– Shaun Vermaak
Nov 15 '18 at 9:14
add a comment |