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

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.

Related

DialogFlow: simple ways of passing parameters between intents and from previous context to the current context? (Without using fullfillment)

Hi I’m look in for simple solutions for passing values between intents and contexts.
I’ve tried to set output context (c1) for intent A, and use c1 as input context for intent B. However, I’m not able to access the parameters value within intent B. Do I have to use fullfillment to implement this ?
Besides, I also want to use the previous parameters’ value of intent A when intent A is triggered next time. Again, can we do this without using fullfillment?
If fullfillment is essential, can you give some guidance please?
Accessing parameter values from one intent to another where contexts are used can be done from the Console itself. Fulfillment Webhook response can also be used but for your use case this can be done from the Console itself.
You can refer to the below replication steps:
In the text response of Default Welcome Intent add Hi what is your name? and add an output context awaiting_name.
Create another Intent Get Name and in that pass “awaiting_name” as input context . Pass some training phrases like "john,sandeep,jacob" and map it with them to the #sys.given.name entity.
In the Get Name Intent the text response is Ok $name, what is your email address?. Add awaiting_email in the output context field of this intent.
Create another intent “Get Email” and add awaiting_email in the Input context. Add training phrases like "sandeep#abc.com","john#xyz.com" and map them with #sys.email entity.
When you want to fetch the parameter value from another intent to the present intent where context is used you need to call it by #context-name.parameter-name as per this doc.
My final output response is Thanks #awaiting_name.name we will contact you soon on $email

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.

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.

Dialogflow webhook - First fulfill the current Intent and then trigger another Intent

Lets say I have two Intents QuotationIntent and SalesRepresentativeIntent.
The QuotationIntent, gets some input from the user and returns appropriate result through web-hook. After successful fulfillment, I want to trigger the SalesRepresentativeIntent to check with the user if they want our sales representative to call them. I am able to trigger the Intent through events. But the problem is QuotationIntent fulfillment message is skipped.
I don't want to add a follow up intent directly to QuotationIntent, as there are many intents from which I will have to trigger SalesRepresentativeIntent.
Can you please tell me how to achieve this? Thanks in advance.
You may use context here. Add output context say "QuotationDone" in your QuotationIntent. Use the same context as the input context for SalesRepresentativeIntent. This way SalesRepresentativeIntent will be triggered only when QuotationIntent is completed.
To trigger SalesRepresentativeIntent you need to add either "user says" phrases and train your agent or add EVENTS to your intent.
This way your SalesRepresentativeIntent will only be triggered when the following condition met:
if((inputContext is present) AND (event is triggered OR user says phrase is present)){
trigger `SalesRepresentativeIntent`
} else {
fallback intent called
}
The other way you can do your task is to use SLOTS. Here in single intent, you can have multiple parameters collected. Add parameters that you want to collect. In your case whatever you are collecting in QuotationIntent you can collect it in first few parameters and make them as required and then the things you need to collect in SalesRepresentativeIntent you can collect in other parameters in the same intent. Arrange the order of the parameters in the order you want your bot asks from your users. This way your responses will be asked automatically depending on the parameters are collected from the user or not.

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