Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bot.beginDialog causes unexpected message if dialog already open #1878

Closed
cooperka opened this issue Dec 19, 2019 · 5 comments · Fixed by #1929
Closed

bot.beginDialog causes unexpected message if dialog already open #1878

cooperka opened this issue Dec 19, 2019 · 5 comments · Fixed by #1929

Comments

@cooperka
Copy link
Contributor

cooperka commented Dec 19, 2019

Issue

Using bot.beginDialog or bot.replaceDialog when there's already a dialog open (e.g. to switch to the new dialog based on user input) causes the bot to automatically receive an unexpected {} message.

This message breaks questions, because the empty message is interpreted by botkit as an answer to the question, and the user doesn't have a chance to give input.

Demo

I made a simple working demo app here that you can clone to see the issue.

  1. Start the emulator
  2. Say hi to trigger ONBOARDING_DIALOG
  3. Say anything for your name
  4. Say yes to confirm and trigger ONBOARDING_DIALOG_2
  5. onboarding2 asks for your name, and immediately receives {} as a response without your input. It's impossible to reply with your name.

Workaround

See this commit for a successful workaround using dialog.addGotoDialog instead of bot.beginDialog.

It's great that this works, but it isn't possible to use this in all cases (e.g. this issue).

Context

  • Botkit version: 4.6.1
  • Messaging Platform: Emulator
  • Node version: 10.15.3
  • OS: Mac 10.14
@stale
Copy link

stale bot commented Feb 17, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 17, 2020
@cooperka
Copy link
Contributor Author

[not stale, looks like others have experienced as well]

@stale stale bot removed the stale label Feb 17, 2020
@benbrown
Copy link
Contributor

I FINALLY FIGURED THIS OUT!

@benbrown
Copy link
Contributor

This had to do with the fact that, inside the handler, the active dialog was changing.

AFTER the handler is run, it attempts to continue on to the next step.

Since the dialog had changed, it resumed improperly.
I believe that the proper behavior is to end the turn, because the new child dialog has taken control.

Still some work to do to validate but I think this will be addressed soon.

@benbrown
Copy link
Contributor

OK! This is going to be addressed in the next release. HOWEVER, there is a follow up bug that I discovered while fixing this.

Calling beginDialog from an ask() will cause the next outgoing message in that dialog to be skipped. :/

#1932

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants