how to handle the wrongly capture input from user in dialogflow? - dialogflow-es

I have created a chatbot using dialogflow using four intents and I am passing contexts form one intent to another intents .
welcome intent
GetName intent
GetEmail intent
GetDOB intent
I wanted to know how to call fallback intent if user entered wrong name. It should call GetNameFallback intent , for wrong email it should call GetEmailFallback intent. For wrong DOB it should call GetDOBFallback intent.
For each specific intent it should call its specific Fallback intents
Here is the list of contexts I am passing:
(welcome intent) - output context : awaiting_name
(GetName intent ) input context : awaiting_name and output context : awaiting_email
(GetEmail intent ) input context : awaiting_email and output context : awaiting_dob
(GetDOB intent ) input context : awaiting_dob

From the Dialogflow docs: "When you create an agent, the Default Fallback Intent is automatically configured with a variety of static text responses, like "I didn't get that. Can you say it again?" and "Sorry, what was that?" This intent is matched when your user's input does not match any other intent; in other words, it's a kind of catch-all for any unrecognized user input.
For example, say that your agent has only one custom intent named weather that recognizes user input like "What is the weather today?" or "Forecast tomorrow". If a user speaking to your agent says "I like the color purple", your Default Fallback Intent is matched because the agent isn't able to match the input to the weather intent."
Based on that information, you might try training your agent to match an incorrect name / email to an intent like Fallback Intent - Name or Fallback Intent - Email, where those intents reprompt the user for the name again.
Without seeing your fulfillment code, it's hard to say for sure whether or not this strategy will work. If you update your question to include your current fulfillment code, you might get a more relevant answer.

Related

how do I use an entity value input by the user across different intent responses

I take a parameter input from user in one intent. Then can I use it for a response message in a future intent if so the how. For the same intent i can just use $value. but how to use if for a different intent response.

Is there a way to trigger the custom fallback intent instead of the default fallback?

In Dialogflow-es, I want to trigger the Custom fallback intent ("Want an appointment-service-fallback") anytime the user doesn't trigger the other intent ("Want an appointment - service-hairdressor") with the training phrases.
However, I'm not sure how to set it up and I keep triggering the default fallback intent.
The way you have the Intents setup are as Followup Intents, meaning they will only be matched in the turn (or two) after the Intent they're following up on has matched.
So in your illustration, in order for the "service-Fallback" intent to be triggered, the conversation must have:
Matched the "want an appointment" Intent by something the user said
Then matched the "service" Intent on the next exchange with what the user said
And then, when the user said something else, it can't have matched the hairdresser phrase
So unless you have gotten to that point in the conversation, you won't end up triggering the "service-Fallback" intent.

How to return the users message on a fallback intent?

I have a bot that answers question related to a certain topic. However, the user may say something that doesn't match with any intent I have. This phrases need to be stored on a database.
So far, I found out that I need to create a fallback intent. How can I make it so upon being triggered this intent returns a response with the text that triggered the intent?
Also, if I only have one fallback intent, will every missed match trigger it or do I have to link it in some way to all my intents?
The easiest way to do something with the user input in a Fallback Intent is through your fulfillment webhook. In the request object that is sent, you can look at the queryResult.queryText parameter to get the text from the user. You can then send this as part of your response as part of the fulfillmentMessages object.
You can't "attach" a Fallback Intent to a regular Intent. That doesn't actually make sense, since Intents represent what a user says, rather than the state of the conversation.
While there is a single Fallback Intent available, which can catch all no-match phrases, it is also possible to create Fallback Intents that only trigger if specific input contexts are set. If you have regular Intents with these same input contexts set, then the Fallback Intent with the context would catch anything they don't.

Get parameter value that didn't match original intent in a follow-up intent

Coding in NodeJS - Google Cloud Functions and actions-on-google library. All intents are fulfilled from the back-end.
I have an "Add to List" intent that matches to a "product" entity. When the user says something that does not match one of the entries in the entity list, it defaults to an "Add to List Fallback" fallback intent which asks the user "Do you want us to follow up with you about this unlisted product?", which has a fallback intent of "Add to List Fallback - Yes" for a "yes" answer.
My question - how in that final intent can I access what the user said in the first place? It never matched as the "product" parameter. I'm thinking it's something to do with the context, but not sure how to set that up in DialogFlow or access it in JS.
Thanks.
Since you are using fulfillment for everything, including that Fallback Intent, the easiest solution would be to store the value of what they said in the Fallback Intent in either a context or in the Assistant's session storage and access it from the Intent Handler for the "yes" Followup Intent.
Got it! This is how I was able to store the value in the conversation session data:
conv.data.reqProduct = conv.request.inputs[0].arguments[0].rawText;

DialogFlow- Invoke intent without training phrases and saving response

I'm trying to build a basic "question/answer" app in Actions using DialogFlow. Right now I have two intents:
Intent 1: User says "Ask me a question" and the intent responds "Tell me about yourself"
Intent 2: I'd like to capture the user response to "tell me about yourself", but frankly there's no way to write enough training phrases to cover it.
I tried following this suggestion, and having Intent 1 send an output context called save_response and Intent 2 has an input context of save_response. Then for the training phrase I used #sys.any:save_response
When I try this action, it just invokes the default fallback intent every time. Thoughts on where I might be going wrong?
You need to create 2 intents, in the first intent your training phrase would be Ask me a question, output context will be save_response and response will be the question which you want to throw at the user.
Then in intent 2, you need to do following:
Set input context to save_response, so that it will only be
triggered when this is present in the contexts
Go to actions and parameters section and create a parameter named
answer, give entity type as #sys.any
Then go to training phrases section and add any training phrase, then
highlight it all, and select the parameter you just created
After that, your training phrases and entity section will be looking
like something like below image
Save the intent and you are done
Hope it helps.
In general, having an Intent with a training phrase that consists only of #sys.any may not always work as you expect.
Better would be to have a Fallback Intent that has the Input Context set to make sure you only capture things in that state (save_response in your case) and then to use the full text captured in your fulfillment.
When doing it this way, you do not need the "Intent 2" you described - or rather, this would be a Fallback Intent that you create in the Dialogflow UI. The Fallback Intent is triggered if no other Intent would match what the user has said.
To create a Fallback Intent, select the three dots in the upper right of the Dialogflow UI
then select "Create Fallback Intent"
The Fallback Intent editor is very similar to the normal Intent editor. The biggest difference is that the phrases you enter (and you don't need to enter any) will explicitly not match this Intent, and there are no parameters. Other aspects (the name, the Incoming Context, turning on fulfillment) are the same.

Resources