You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code comments in the SDK clearly states that onDialog should be used to "handle Dialog activity"; however, every JS sample I've looked at splits dialog activity between the onMessage and onDialog handlers.
To Reproduce
Steps to reproduce the behavior:
Look at the code comments for onDialog:
/** * onDialog fires at the end of the event emission process, and should be used to handle Dialog activity. * @remarks * ... * @param handler BotHandler A handler function in the form async(context, next) => { ... } */publiconDialog(handler: BotHandler): this{returnthis.on('Dialog',handler);}
Our official samples follow our own best practices.
Additional context
Using onMessage as the "jumping off point" for beginning or continuing a dialog is problematic for dialogs that need to handle authentication (event activity) or ones that might welcome a user to the conversation (conversationUpdate activity).
A similar issue exists in the C# samples, but we have no corresponding guidance to use the OnTurn handler after it's inner call to next completes.
[bug]
The text was updated successfully, but these errors were encountered:
One additional scenario where we don't use onDialog for dialogs but should, is for bots using the ActivityPrompt. ActivityPrompt was created with the idea that a user might not necessarily respond to a prompt with a "Message"-type activity. They might instead perform an event that the bot interprets as a response to a the prompt.
E.g. A voice-enabled bot in a car asks the driver to put on their seatbelt. When the driver puts on their seatbelt, the bot should not wait for the driver to say "my seatbelt is on". The car should send an "Event"-type activity to the bot once the seatbelt is engaged, indicating that the driver responded to the prompt.
Sample information
Describe the bug
The code comments in the SDK clearly states that
onDialog
should be used to "handle Dialog activity"; however, every JS sample I've looked at splits dialog activity between theonMessage
andonDialog
handlers.To Reproduce
Steps to reproduce the behavior:
onDialog
:BotBuilder-Samples/samples/javascript_nodejs/05.multi-turn-prompt/bots/dialogBot.js
Lines 24 to 38 in 4308b01
Expected behavior
Our official samples follow our own best practices.
Additional context
Using
onMessage
as the "jumping off point" for beginning or continuing a dialog is problematic for dialogs that need to handle authentication (event activity) or ones that might welcome a user to the conversation (conversationUpdate activity).A similar issue exists in the C# samples, but we have no corresponding guidance to use the
OnTurn
handler after it's inner call tonext
completes.[bug]
The text was updated successfully, but these errors were encountered: