How do I get the users response from a question asked to the user and display the response in fulfillment?
Example:
Google Assistant: What is your name?
User: My name is Yuri Alves
Google Assistant: Hello, Yuri Alves
Here is the simplest way to achieve this:
Setup an intent with the response What is your name?
Setup a follow-up intent, with phrases My name is Yuri Alves, I am Yuri
Alves etc
Make an entity name_entity for recognizing the first name and last name
Mark the entity as required
Give prompt What is your name?
In the response print Hello, $name_entity
Hope it helps.
Related
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.
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.
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.
I want to know after finding the closest match from the text section of the response table how chatterbot is generating the "in_response_to" list and the "in_response_to_contains" list. If somebody could enlight me this then it would be a great help.
The in_response_to list is generated based on previous input statements that the bot receives. So for example, lets say that the following interaction occurs:
User: "Hello, how are you?"
Bot: "I am well, how are you."
User: "I am also well."
In this case, the bot would learn based on how the user responded to it. So "I am also well." is added to the in_response_to list of "I am well, how are you."
For the second part of your question, the in_response_to__contains is an attributed used to tell the chat bot to query the database for statements where the in_response_to field contains a particular response.
I want the invocation name in the middle of the text
Ex: Alexa, where is my order?
I tried, but alexa not recognizing this.
Invocation names for custom skills have to come at the beginning of an utterance. If the utterance doesn't begin with "ask {Invocation name}, Alexa will not search your custom skill and will attempt to deal with the request itself.
Here's a diagram for the required custom skill request format.
Disappointing, I know. Hope this helped!