How do I stop asking the same questions on dialogflow? - dialogflow-es

I'm new to dialogflow. In my default Hello Intent, I have something like this:
Good day! My name is xyz and I'm here to help you. May I know your name please?
This response is for when users say something like "hi"
After that, I will pass the context to another Intent to wait for the name input
I would like to avoid asking these information if I already have the user's contact information. Is there away to check for the context and trigger a different response?

If you just need to check if the context contains a property called "name" or similar, simply add a parameter in the second intent, set its value to #awaiting_contact.name and enable the mandatory option. That will let you define prompts if the property has no value, so you can re-ask the user.
However, I'm not sure what the Welcome Intent context has. You are just giving a welcome message. Then, when the user inputs his name, this will trigger a different intent.

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 access update the next context a user should go to [DialogFlow Fulfillment]

I am using contexts within Dialogflow to call the next intent for the user. What I would like to do is have the ability for someone to change their mind on an answer they just entered. For example, as seen in the image below, if I enter a name then it would ask for an email. However, the user should be able to say "can I change my name" and go back to the context where Dialogflow is asking for a name.
I already have that intent implemented but I am trying to figure out how to go back to the question they were going to answer before deciding to change their name. I can use fulfillment to capture the raw API response and possibly get the last context however how can I force the user after changing their name to go back their previous context/intent?
You can do this easily by using the fulfillment. You have to save the previous intent contexts and prompt as well as the next intent contexts and prompt in the parameters of the intent.

Google Assistant - how to re-prompt the user with #sys.any when an input is determined to be invalid

I'm trying to create a custom action through Google Assistant. I have custom user data which is defined by the user and I want the user to ask me something about this data, identifying which data they want to know about by supplying it's name.
ex:
User says "Tell me about Fred"
Assistant replies with "Fred is red"
[
{
"name":"Fred",
"info":"Fred is red"
}
]
The problem I'm having is how to add a Training phrases or re-prompting for the user to use when they supply a name which doesn't exist.
ex:
User says "Tell me about Greg"
Assistant replies with "I couldn't find 'Greg'. Who would you like to know about?"
[
{
"name":"Fred",
"info":"Fred is red"
}
]
I've tried adding a Training response which only contains the 'name' parameter, but then if the user says "Tell me about Fred", the "name" parameter is set to "Tell me about Fred" instead of just "Fred", which means it ignores other Training responses I have setup.
Anyone out there who can be my Obi-wan Kenobi?
Edit:
I've used Alexa for this same project and have sent to Alexa an elicitSlot directive. Can something similar be implemented?
There is no real equivalent to an elicitSlot directive in this case (at least not the way I usually see it used), but it does provide several tools for accomplishing what you're trying to do.
The general approach is that, when sending your reply, you also set an Output Context with the reply. You can set as parameters for the Context any information that you want to retain (what value you're prompting for and possibly other state you've already collected).
Then you can have Intents that have this context set as an Input Context. The Intent will then only be matched if the Context is active. This Intent can match #sys.any, or whatever other Entity type might be appropriate in this case.
One advantage of this approach is that it allows for users to reply more conversationally, or pivot their reply away from the prompting question you've just asked. It allows for users to answer within the Context, or through other Intents that you've already setup for other purposes.

Dialogflow required parameters

In my dialogflow chatbot i am creating i have a scenario where a user can ask what are the available vacancies you have or they can directly ask i want to join as a project manager or something. Both are in the same intent called "jobs" and the position they want is a required parameter. If user don't mention the position (eg - "what are the available vacancies you have" ) it will list all available vacancies and minimum qualifications need for that vacancy and ask user to pick one (done with slotfilling for webhook.). Now since the intent is waiting for the parameter when user enter the position they like it will provide the details regarding that position. But even when user is trying to ask for something else (trying to call to a another intent or they don't have enough qualifications for that vacancy or the needed job is not listed with the available job list) since that parameter (the Job position) is not provided it ask again and again what is the position you want.
how do i call to another intent when the chatbot is waiting for a required parameter
There is a separate intent for "The job i want is not here". If i typed the exact same one i used to train that intent then i works. but if it is slightly different then it won't work
Try this:
make your parameter as "NOT" required by unchecking the required checkbox.
keep webhook for slot filling.
in the webhook, keep a track if the parameter is provided or not.
if the intent is triggered, check programmatically for parameter and ask the user to provide it by playing with the contexts.
if the user said something else, then there will be no "required" parameter as per Dialogflow and it will not ask repeatedly to provide the parameter.
Let me know if this helped.

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.

Resources