Input/Output context of intent in dialogflow - dialogflow-es

Hello World!
I need your help in dialogflow v2.
I have to ask and get user informations like gender, last-name, first-name, maiden-name.
Diagram of my intents
List of intents
Detail of an intent
After the welcome intent, I have the Gender intent. After that, there is the last-name intent.
If the user is Mr, then we have last-name and after the first-name.
For Mme, we want the married-name. We ask if the married-name and the maiden-name are same. If not, we need the maiden-name. And at the end, we ask for the first-name.
In the first scenario, dialogflow always ask the first-name at the end.
For the second scenario, when dialogflow ask the first-name, it doesn't understand the answer.
In last scenario, when the user answer for maiden-name, dialogflow doesn't understand.
Have you got an idee to resolve this?
Thank you for your help!

use slots to collect the parameters like gender, name, etc in a single intent
Check this issue. I have posted something that might help you.
Recognizing non-English/American names have an issue with the Dialogflow.

Related

Dialogflow: move to specific intent

I'm developing a chatbot in Dialogflow and, in order to make it easier to me to get the parameters I need, I would like to "force" the conversation to go to a specific intent, where those parameters are required.
As far as I've seen, there is no way to move between intents as there is no such thing as a "flow" between them, but is there any other way to try to force my system to fall into a specific intent?
I'm not sure about how Contexts and Events work, so maybe using those functionalities?
In my case, I start the conversation in the Welcome intent, as usual, and then I say "I want to make an enquiry". This sends me to an "initicialization" that as me to enter my user name. Here is where I would like to go to my specific "user" intent, where the user name and other parameters are required in Actions and Parameters.
Thanks in advance for the help!

How to ask the user to add new element in DialogFlow?

I am trying to build a bot in Dialogflow.
Here is what I need:
customer: Hello
bot: hello, what's your name?
customer: John
bot: Please enter the first element.
customer: element1
bot: Did you finish?
customer: No
bot: Please enter the second element.
....
Please advise how can I implement it? I am trying to create an intent with action and prompt but the agent doesn't ask me "Please enter the first element".
I also need to make first, second .. a counter that updates with each iteration / question.
Can you please advise where can I find a guideline how to achieve this kind task?
So far I have created an agent and playing with intents.
One way would be to write some code for fulfillment (using webhook or even inline editor), analyze incoming messages in your code and generate answer.
If you don't want to write any code, it should be also possible to achieve this using Dialogflow's context to store some information and followup intents to continue asking for elements. But in case you would like to ask user for multiple elements - it could be hard to maintain in Dialogflow. I have created and tested sample bot this way with following intents:
Please note that I have removed default Welcome intent to not interfere with custom "hello" intent.

Dialogflow automatically goes to Default Welcome Intent after follow up despite telling it not to

How do I ensure that when the user replies to the question:
"Are you wanting a happy, sad, angry or confident song?"
with "Angry", that the agent takes the user back to the "angry" intent (it's grandparent's brother) and not the default welcome intent?
Here is my layout:
DefaultWelcomeIntent-->-Happy-->-Happy-noIncorrectEmotion (back to DefaultWelcomeIntent)
The user replies "happy" to the original "how are you feeling?" question
|_____The user replies "no" to the emotion checker intent (saying "I have
detected that you are "feeling happy, is this correct?"
|_____The user replies that they are angry to the follow up of this
which asks "Are you wanting a happy, sad, angry or confident
song?"
Actual response: goes back to default welcome intent
Intended response: goes to Angry intent
Intended response: goes to Angry intent
I have set the output contexts to be going to angry, sad and confident (although I don't think this does much)
I have also tried changing the intended intent on the Training tab of dialogflow, but this does not do anything either...
Here is the dialog between the user and agent:
My understanding is that follow-up intents form a tree (actually a DAG - directed acyclic graph) so they cannot by definition have loops. Therefore you can't say, "go to my grandparent's intent" in dialogflow.
However there is an out. If you send the request to a webhook, the webhook can reply saying which context and intent to go to. And it can go anywhere, which should allow you to build a loop.
Setting output contexts to be going to angry-followup, sad-followup and confident-followup doesn't seem right. None of those follow-up intents have training about "angry" "happy" "sad" so they won't be understood. I would change the output intent first to see how it behaves.
I solved this by ensuring that the input contexts for the angry intent matched exactly the output contents for the angry checker intent. I found that dialogflow is extremely sensitive to the input and output contexts so one must ensure that they follow each other in a tree like fashion. And as the answer from btliiy says, I used the webhook to do the linking parts backwards up the tree when necessary. Thanks for your help!

Dialogflow inline editor ask for additional info

I am developing a google assistant app on Dialogflow.
And I have a intent that receives two entities: #name and #age
Using the fulfillment throught the inline editor I verify if the #age is below 18.
In that case I need to ask for additional info, I need to ask the name of the person responsible for the child.
I looked around the internet, including the fulfillment samples at https://dialogflow.com/docs/samples
I believe it would look something like this:
let conv = agent.conv();
conv.ask('As your age is under 18 I need the name of the person responsible for you:');
//Some code to retrieve user input into a variable
agent.add(conv);
But I was unable to find how to do it.
Can someone help me to achieve this?
Thanks in advance.
While you are handling an Intent, there is no way to "wait for" the user to respond to your question. Instead, you need to handle user input this way:
You send a response back from your Intent.
The user replies with something they say.
You handle this new user statement through an Intent.
Intents always represent the user taking some action - usually saying something.
So one approach would be to create a new Intent that accepts the user's response. But somehow you need to distinguish this response from the initial Intent that captured the person's name.
One way to do this would be, in the case you ask the question about who the responsible adult is, is to also set a Context. Then you can have a different Intent be triggered only when that Context is set and handle this new Intent to get the name of the adult.

how to train a bot's intent for a user phrase not known?

I have to train my dialogflow bot with a phrase i dont know i.e user can type anything he or she wants but i want that to work with a single intent only.
for example:
U- Good Morning
B- Morning how can i help you?
U- i want to create a ticket
B- Please provide a subject for the issue?
U- No i want to view a ticket with id ABC1234556
Now here bot should back track to another intent which will view the details related to the ticket id but thats not happening i am using dialogflow's system entity i.e #sys.any which captures anything user says. This entity captures anything and even back tracks on other intent's phrases like bye show all ticket's and etc but it just not works with this particular intent phrase!
I hope i have made clear what is bothering!
If you're using #sys.any in an intent to capture all user input after asking Please provide a subject for the issue, it won't be possible for another intent to be matched within Dialogflow.
To get around this issue, you could change your agent design, perhaps by confirming the "subject" in case the user wants to change path.
You could also try and match an intent to whatever text is captured by #sys.any, by calling Dialogflow's detectIntent endpoint from your webhook. However, this might result in unwanted behavior (e.g. if a legitimate ticket subject happened to match one of your intents).

Resources