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
Persistent menu action during a conversation #24
Comments
Hey @uncvr, Thanks for bringing this up, this is an interesting scenario. You're correct, persistent menu callbacks are bypassed during a conversation, so we definitely need to find a solution for this. I'm thinking we could identify which postbacks belong to a persistent menu button and make sure we execute their callbacks even if we're in the middle of a conversation. The only problem that I see with this is that if one of these callbacks starts a new conversation, the bot would lose track of the previous one. The concept of sub-conversations is something I thought about when designing the first version, and it would definitely come in handy here, but I think is out of the scope of this particular problem. I'll start working on a solution that fixes the persistent menu issue without interrupting the flow of the original conversation, we can then handle the sub-conversation issue separately. Thoughts? |
I think you need to work out some use cases here, real scenarios. But it depends on how you're handling your conversations. If you're handling then from "What does this user look like in the database?" then dropping the original convo would be fine. If it's more like the convo API is set up, holding state in some kind of a linked list in memory, then if the original convo's state is important, we're in trouble. So unless you completely re-design how conversations are implemented, this is really a case by case issue. Maybe the solution would be to add more introspection or control into how conversations are handled, to give people who need more control to have that control. What makes the most sense to me is:
What's the worst possible situation in each scenario? |
Any updates on when this might be implemented? As the bot grows, the need to "hear" persistent menu postbacks when in any conversation, increases. :D |
Alright, I've been thinking about this and I think I have a pretty solid idea of what we should do in this case. As @pferdefleisch mentioned, we should think about real use cases where this might become a problem for the two possible scenarios (always considering that the user was in the middle of a conversation and at some point, clicked on a menu item):
For 1) I think it's pretty clear that we need to drop the original conversation and start the new one. Worst case scenario here is that the bot was saving information in the conversation's context (using For 2), I'm not entirely sure that we should keep the conversation alive because it might be confusing from the user's perspective. Consider the following example:
So for scenarios like this one, I'm leaning towards ending the conversation even if the menu item didn't start a new one. I'd love your thoughts on this one before I start working on it. |
I agree that it should end the current conversation but it should be designed to listen to specific persistent menu items. I was thinking an item like "Cancel Conversation" that would help the user cancel at anytime. |
@sotirelisc do you mean manually ending the conversation with a "Cancel Conversation" item in the Persistent Menu? I was thinking that ANY persistent menu item should end the current conversation before doing whatever it is the menu item does. Also, the persistent menu is a single instance that is shared across all users, so you won't be able to update it depending on whether the user is in a conversation or not. If you wanted to have a "Cancel Conversation" button in the Persistent Menu that is visible only when the user is in the middle of a conversation, I'm afraid it's not possible at the moment due to the way Facebook handles this menu. |
@Charca, I was thinking that the "Cancel Conversation" item will be always there but it would function only if there is an active conversation. |
This is a UX issue. A user doesn't know they are in a "Conversation". They are just chatting with a bot. |
@pferdefleisch, yes, but they probably know they are inside an ordering process. They know that they have started something that sometime in the future will end. |
@Charca, any ideas on this one? |
IMO, a menu button push should end any current conversation. This seems like a fair tradeoff to me because I believe this issue really is a bug. A practical example:
Cheers |
In my case, I'm building an ordering bot. I can't have users canceling a whole order just because they hit an item of the persistent menu. However, if for any reason the bot becomes unresponsive during the ordering proccess, a canceling option in the persistent menu, would be great. |
I imagine you would keep your order state somewhere so you wouldn't have to drop your order on the floor. You would just need to do something like check if there is an open order after each menu or other out of bound response and give the user an option to continue the order:
|
I think this is a fair tradeoff, allows flexibility and won't add a bunch of complexity to the codebase. It probably only needs a "Is this a menu (out of bound) postback? Ok: Deal with it. No: Are we in a conversation? Yes: handle conversation. No: Send to hear's... |
@pferdefleisch, hmm.. Yes, sounds like a legit solution. |
any suggestions/modifications on how to break the old conversation out (and not completing it) and start a new one when a menu button is clicked ? @Charca |
And here is why my bot was acting very strange. I was experiencing this problem with my bot. |
@michaelreda
|
This solution is a hack (calling a "private" method) which works currently but relies on private implementation details that could change at any time. There is a place to hook into this, and the framework already does it for postback buttons that are created with a string. The framework sets Does this sound reasonable to everyone? |
Hey! It seems I've got a little late to the conversation :) First, I upvoted some of the comments above because I agree a current conversation can be dropped if the user calls a persistent menu postback, specially if I would be able to subscribe to the end event and have access to the last shared state of the convo as @Charca pointed out in the beginning. My scenario is similar but not quite the "Cancel button", because I want to react in such a way that if the user wants to start over I drop the data I have and restart my conversation from the first interaction, there my first interaction can maybe look for my persistent state 🤔 and take it from there. But I got a little lost in the the last two comments, I'm not sure I follow @tmwd 's hack, or understand what @mraaroncruz is suggesting. In short, is there a way for me to hook up into the post backs that are being dropped by the conversation or not? |
Hi,
From what I understand, bot.on and bot.hear are bypassed during a conversation.
Since callback from persistent menu are handled in bot.hear, how can we handle those events during a conversation ?
The text was updated successfully, but these errors were encountered: