using entity in other intent in dialogflow - webhooks

In intent A, under 'Training Phrases', I added a user expression.
eg.#sys.given-name:given-name So that Google Assistant is able to read any name given by user.
In intent B, i added user phone number. I want Google Assistant to print out my given name which i previously mention in intent A and phone number.
eg..
You name is $given-name and your number is $phone-number.
but it can't seem to print out the given-name. Any suggestions on what should be added?

You can set an output-context in intent A, then use that context in intent 2 to print the given-name.
For example: in intent 1 you will set name as output context, then in intent 2 you will respond with -
Your name is #name.given-name and your number is $phone-number.

Related

Google Dialogflow is not detecting all the entities in the user entered text

We are trying to implement chatbot using Google dialog flow. Created 2 intents (movies & purchases) as below.
And created 2 Entities (Movies & Purchases as below).
When I tested it with 'I cannot watch my purchased movie', it is detecting 'movies' intent and it is detecting only one entity 'movies'. It is not detecting 'purchases' entity even though the word 'purchased' is in the user entered text.
Can any one please let me know how to make sure that dialog flow detects all the entities present in the user entered text and also why it is detecting 'movies' intent as 'purchases' intent also have the training phrases that can match the user entered text.
In the image of your conversation in Dialogflow it shows that Dialogflow matched the user phrase to the movie intent. In your movie intent setup you have setup only 1 parameter,
movies. Dialogflow will only recognize one entity because you have setup the intent to only look for 1 entity.
If you want the movie intent to be able to recognize both entities you should add a phrase that contains both a movies and a purchase intent and make sure both entities are available in the Actions and Parameters section of your intent.
Here is a quick example that detects a gender and an age category entity.

How to display user input which was taken in another intent in Dialogflow?

usually, we use '$' to access the values. eg: Age is $age. but this only works if "age" is inputted in the current intent. What if I have a series of intents connected using contexts (followup intents) and at last I want to display all the input values to the user.
You can access this name in Dialogflow by entering #context_name.parameter_name (where context_name is the name of the context and parameter_name is the name of the parameter). This works for any response, as long as the context is currently active and the user has provided a value for the parameter.

Dialogflow navigate through conversation using fulfillment

I have an intent that is triggering the fulfillment logic which based on the extracted entities and intent name should decide which text and which custom payload should be returned to the client. Example:
intent A(to fulfillment): I want to buy some eggs(entity)
fulfillment:
if we_have_eggs_in_store
go to intent A
else
go to intent B
intent A: How many eggs you want?
intent B: We currently don't have any eggs in our store...
constraints:
1. I don't want to store the response text in the fulfillment
2. I want to pass custom payload back to the client
Is this possible to achieve with the Dialogflow?

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

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.

how can we pass the user original query across all followup intent in dialogflow

I have one intent named "search.category" which has user queries like "32gb phones" and it has a follow up intent to get_brand question like "do you have any specific brand? ".
This can have two type of answers that user can enter brand name or he can say "I don't know."
Is there any way to pass the whole user query in main intent to followup intents.
How can we pass the original user query(32gb phones) as a parameter across the intents?
In the second picture, you can see that two entities are selected, so is there any way to select the other text from user query ( I want the "show me some under 40000")
To do this, you would create a new Output Context on the first intent. Output contexts created as part of an intent contain the parameters that were set by the user when they were created and are available in subsequent intents (for as long as their lifespan is active). You can access the context's parameters either in the response or in your fulfillment webhook.
If you're trying to use values that aren't set in the parameters, then in the fulfillment of the original intent you can set any value you want as a parameter of an Output Context that you create in your webhook.

Resources