Carousel item invoking another intent (not the followup actions_intent_option) - dialogflow-es

I need some help here. I have a google assistant food recipes bot with the following intents:
[GET_RECIPES_BY_NAME]
[GET_RECIPES_BY_CAROUSEL]
-----[GET_OPTION]
So, when the user says "I want a chocolate cake", the dialogflow invokes the [GET_RECIPES_BY_NAME].
When user says "See menu", the bot shows the carousel. But, when the user taps the item, the dialogflow is invoking the [GET_RECIPES_BY_NAME] too, not the [GET_OPTION].
It is using/returning the title instead of the option/key.
[GET_OPTION] intent was set as followup with the context and event actions_intent_OPTION.
The flow is a little bit more complex, but I revised it to make it more comprehensible. All the intents handles are in the fulfillment.
I tried many solutions: [GET_OPTION] as followup, as in the first level, deleting and recreating all the contexts in fulfillment....and so on, and nothing.
An important detail: recipes that don't not have the training in [GET_RECIPES_BY_NAME] call correctly in the [GET_OPTION].
My question is this: If I set any followup intent and set it with the event actions_intent_OPTION, shouldn't this always be invoked when I tap the carousel item?

Related

Redirect intent on Dialogflow

I have a "Welcome" intent in Dialogflow, which shows the user various options such as "Breakfast Menu" or "Dinner Menu". I'm thinking about adding an option so that when a user misclicks one of the menus and they type "Return", they can be sent back to the options shown in the "Welcome" intent. How can I do this? Thanks in advance.
You can use the follow-up intents to manage this kind of behavior. Specifically the predefined "previous" child intent.

How to handle clicks in buttons left on screen but no longer valid, in Microsoft Bot Framework?

I'm a bit confused about something. We are building a bot with Microsoft Bot Framework (v3 -- I know, I know, it's old, but that's what they want us to do) and at startup we offer the user th choice of two paths to follow, using buttons. It works fine, but the buttons remain on the screen after the user has clicked, as is normal. Should we attempt to handle a user click in the buttons after we have passed from their actual point of use? That is, let's say we've passed through all our waterfalls and are back at the root dialog? How we detect these clicks and intercept them and give suitable feedback (e.g. "That's not a valid choice"?).
At present, it seems there is some routing going on before the user click even gets to our root dialog --
> ChatConnector: message received. UniversalBot("*") routing <null> from
> "emulator" Library("BotBuilder").findRoutes() explanation:
> ActiveDialog(0.1) ...BotBuilder:prompt-text - WARN: Prompt - no
> intent handler found for null ...BotBuilder:prompt-text -
> Session.send() ...BotBuilder:prompt-text - Session.sendBatch() sending
> 1 message(s)
A generic "I didn't understand. Please try again." reply is sent automatically, which seems to come from botbuilder/systemResources.js. Is this, then, the correct and expect behaviour?
I'm a bit confused, as I thought the message would always get to the root dialog and we would have a chance to evaluate it there. I've put a breakpoint in the root dialog, but it never reaches it when I click on an 'already used' button.
Thanks for any insights!
I've faced a similar scenario. I have several forms as adaptive cards and also a carousel of hero cards. What I do is make sure some of the data returned on buttons clicks (or taps) is unique for every form. Then when I'm expecting a form I check if it's the right one, otherwise anything else (including messages with no luis intents) is rejected and I ask the user to answer the current question or cancel while looping back a step.
So for example, in the data for this button
"actions": [
{
"type": "Action.Submit",
"title": "Submit",
"data": {
"x": 13
}
}
...
]
I would add "form" or maybe "dialog" with unique values that you can check for when you expect a specific form/card. In other places where I just expect text then I just ignore forms and re-ask the question.
I'm not how it works for NodeJs but in C#, buttons (and CardActions with MessageBack/PostBack) come under Context.Activity.Value whereas text responses are in Context.Activity.Text

Dialogflow followup intent not triggering on Actions on Google

The setup:
My 'Default Welcome Intent' asks the user "Choose between Amsterdam, Berlin, Frankfurt, London".
Then I've created a custom followup intent.
I've also created an entity called 'location', which I've added the four cities to.
My followup intent looks like this:
Here's the problem:
When I run the app in Actions on Google simulator, it always triggers the "Default Fallback Intent", and doesn't trigger the followup intent.
Here are some more screenshots of my setup, as requested in the comments:
The issue was me not reading the documentation properly. I've stupidly skipped the part where it explains how to accept card responses.
app.intent('Carousel - OPTION', (conv, params, option) => {
const SELECTED_ITEM_RESPONSES = {
'SELECTION_KEY_ONE': 'You selected the first item',
'SELECTION_KEY_GOOGLE_HOME': 'You selected the Google Home!',
'SELECTION_KEY_GOOGLE_PIXEL': 'You selected the Google Pixel!',
};
conv.ask(SELECTED_ITEM_RESPONSES[option]);
conv.ask('Which response would you like to see next?');
});
https://developers.google.com/actions/assistant/responses

Select intent not triggered if selection is not immediately followed by carousel

I am facing a problem with listening to User Selection when we show a carousel. We are using askWithCarousel with dialogFlow and listening to click of a carousel item using actions_intent_option event. When a carousel is displayed to user, assistant starts listening to user input using mic, if mic gets a random input from user (which doesn’t match any of our synonyms for the carousel items) and then the user taps on any carousel item or says any of the synonyms, actions_intent_option event is not getting fired. It works fine if this interaction is immediately followed by showing of carousel. Else, it will take carousel title as user input and resolves to a different intent.
Not able to get the id of the carousel item because of this. Is there a way to disable mic or emit actions_intent_option even when the user clicks on carousel item later. Please help with this flow.
Selection events are only emitted, as you've discovered, right after the carousel or list has been sent to the user.
I'd recommend setting up a fallback intent to check for the titles of the list items or prompting the user with a carousel or list again.

How to stop QnAMaker dialog from returning to parent dialog?

Trying to understand MS Bot Framework and build my first bot.
The default dialog is a Prompts.choice. First choice passes to new dialog that asks for Prompts.text.
User enters text which then passes that to my QnAMaker, which looks for the answer and returns it. This works as expected.
After answer is returned, my bot closes the QnAMaker dialog and then returns to the default dialog where the bot starts over from the beginning. I don't want this to happen.
How do I keep the user in the QnAMaker dialog so that they can continually ask QNAMaker questions until they are done and want to do something else in the bot?
Screenshot of terminal output. Code below. Thanks!
bot.dialog('rentalHelp', [
function(session) {
builder.Prompts.text(session, "In which state do you live? (please spell out)");
},
function(session, results) {
// start the QnA bot dialog
session.beginDialog('QnAMaker');
}
]);
I think I figured out the reason it was doing this from Bot SDK chat reference library
Excerpt:
note: Waterfalls have a hidden last step which will automatically end the current dialog if if you call a prompt or dialog from the last step. This is useful where you have a deep stack of dialogs and want a call to session.endDialog() from the last child on the stack to end the entire stack. The close of the last child will trigger all of its parents to move to this hidden step which will cascade the close all the way up the stack. This is typically a desired behavior but if you want to avoid it or stop it somewhere in the middle you'll need to add a step to the end of your waterfall that either does nothing or calls something like session.send() which isn't going to advance the waterfall forward.
It would be great if someone could confirm this is the problem or help me to improve my code.

Resources