What would be the best way of accessing the previous conversation details when Dialogflow maps the input to a fallback intent?
We'd like to steer the user back into the right direction by re-prompting the last suggestion chips that were given.
The way we do it now is by manually saving the last suggestions and manually resetting them if the conversation is progressing to new intent. Not optimal and error prone.
It would be good if all fallback intents contained the "last intent/response" information.
I also can't find the isFallback properety on the DialogflowConversation object in the AoG SDK. So we're not able to reliably implement logic in the middleware handler. The isFallback property would be very useful to have access to on the conversation object in intent handler functions.
Any best practices for reliably setting and resetting a memory of last conversation for usage in case of fallback?
You can save all your current intent response details in a new output context. Fetch that previous intent response from the previous intent output context and the use that data to create a new response for the fallback intent.
how about if you use conv.action or conv.intent to check for your fallback intent? You can create a middleware function that stores all the information you need from each conversation in user.data if it is not a fallback intent and use that in your fallback intent handler.
Related
During Chatbot Creation with Dialogflow, suppose user asked some question which wasn't save in intent then how the System will respond that question, in case I'm getting such question, then how we'll deal with it?
When creating a Dialogflow bot you train your bot to respond to phrases by adding them to intents. Any phrases that Dialogflow cannot match to your intents will be handled by a fallback intent. Each Dialogflow bot will have atleast 1 fallback intent called the Default Fallback intent.
In this intent you can set the standard response which you want to use when a user answers with a phrase that your bot doesn't understand.
Besides the default fallback intent you can also add extra fallback intents. You could do this if you want to give a more helpful response to guide your user back on track. This also allows you to set a certain context so that the user doesn't go back to the start of the conversation when they enter something the bot doesn't understand. You can do this by clicking the Add follow-up intent option and selecting fallback from the dropdown.
So I have a flow prepared.
User: I would like to book an appointment
Bot: Sure. Does 3pm works for you?
User: Yes
Bot: Great. Appointment has been set. (Response from Fulfillment)
Bot: Anything else you need help with? Yes | No (How to achieve this)
I have tried triggering followupEvent but that won't display any response till the chain of intent is complete.
When the followupEventInput parameter is set for a WebhookResponse,
Dialogflow ignores the fulfillmentText, fulfillmentMessages, and
payload fields. When Dialogflow receives a webhook response that
includes an event, it immediately triggers the corresponding intent in
which it was defined.
I have End Intents ready for response for Yes and No. But need help in triggering it.
An intent shouldn't be used as a step in your flow or be tied to a single response, its intended to represent a category of phrases your user might say to complete a certain goal in your conversation. Since the was this helpful isn't triggered by any user phrase, but more as a trigger for the user to continue the conversation shows that it shouldn't be a separate intent.
Having the was this helpful phrase be available to multiple intents is a good choice so it can be used throughout your conversation, but I would recommend saving this phrase in a file, an API or a CMS and retrieving the response via code.
I'm not a PHP developer, but I expect it to be along the lines of: responseService.getResponse("requestFeedbackPrompt");
This allows you to retrieve the was this helpful phrase throughout your code, without making the mistake of making a seperate intent for it, as this will create problems later on with keeping state.
If you would decide to go with a single intent for this, you will quickly see that it will become difficult to maintain track of context, states and which step of the conversation you are in as multiple intents will go through this generic intent.
What would you do if you need a different variant of the was this helpful response, with the single intent, you will end up creating an intent for each variation and you will have to align the conversation flow and state accordingly every time.
If you use the service, you just call responseService.getResponse("OtherFeedbackPrompt);`
Hi have something similar in one of my bots. I have taken a different approach to those mentioned.
My bot asks if there's anything it can help with at the end of a an acknowledgement fulfilment.
The customer then has the option to respond with Yes or No.
Within the page that asks the question I have created routes.
One route for Yes and another for No.
The Yes route directs customers back to the point where they can start making selections. The No route provides a fulfilment to the customer and ends the session. I have used Yes and No intents for these.
I have created 5 intents in a Dialog flow. After completion of first intent, it should automatically go to the second intent without the use of the training phase. Is there any possibility to do that?
This probably isn't what you want to do. Remember that Intents capture what the user says or does and not how Dialogflow should respond.
If you want to do a series of things when the user says one thing, then you can do all those things in your fulfillment webhook. Your webhook is where you actually do something based on what the user has said, and this can be handled in one function call or several calls that you make from your Intent Handler.
There are two possibilities either you can use contexts or if you want to handle sequence from webhook service you can use events.
For webhook solution,
Give each Intent a specific event and action.
In your webhook request you will get action of your intent and you can trigger next event based on current action. => Dialogflow
For context solution
You can add Follow up intents for your each intents, Follow-up-intents
I'm trying to build a movie bot, and I need to save the ID from a movie which I got via my webhook, and keep it in a place where can be access by the follow up intents in that context.
Right now I'm using the payload in fulfillment to pass data to the first intent, but in the follow up intents that data is lost.
You should probably include the data you want remembered across intents in a context. You should set the lifespan to be long enough for all the intents that will need the info.
Following this command in node.js using the ApiAiApp module:
app.askForPermission('To know what day it is where you are',
app.SupportedPermissions.DEVICE_PRECISE_LOCATION);
I get the following in the Actions on Google Simulator.
It correctly prompts for my response, but then is confused and doesn't recognize my answer! Is there something missing or broken in my API.AI agent? After the askForPermission, there are no other fulfillment calls.
The problem is likely that you need to set an Intent that will be triggered when the permission is granted. You do this by setting the Event to actions_intent_PERMISSION.
This will look something like this:
You can set the Action to whatever makes sense for your webhook, and be sure to enable webhook fulfillment for the Intent as well.
If you need to keep track of where the permission request was initiated from, and handle it through a different Action, you can set a Context and have different handling Intents based on different Context settings.
The Fallback Intent method works because there is no better match at that point since you hadn't specified a regular Intent with actions_intent_PERMISSION. It isn't the best choice, however, since it could match other situations from your user.
The concept that I was missing is mentioned here.
All you have to do is create a child fallback intent for the intent
you are requesting permissions from.
So if you have a few intents that ask for permissions, each of them need their own fallback intent.