Reputation: 115
I'm trying to build a basic "question/answer" app in Actions using DialogFlow. Right now I have two intents:
Intent 1: User says "Ask me a question" and the intent responds "Tell me about yourself"
Intent 2: I'd like to capture the user response to "tell me about yourself", but frankly there's no way to write enough training phrases to cover it.
I tried following this suggestion, and having Intent 1 send an output context called save_response
and Intent 2 has an input context of save_response
. Then for the training phrase I used @sys.any:save_response
When I try this action, it just invokes the default fallback intent every time. Thoughts on where I might be going wrong?
Upvotes: 1
Views: 2874
Reputation: 50731
In general, having an Intent with a training phrase that consists only of @sys.any
may not always work as you expect.
Better would be to have a Fallback Intent that has the Input Context set to make sure you only capture things in that state (save_response
in your case) and then to use the full text captured in your fulfillment.
When doing it this way, you do not need the "Intent 2" you described - or rather, this would be a Fallback Intent that you create in the Dialogflow UI. The Fallback Intent is triggered if no other Intent would match what the user has said.
To create a Fallback Intent, select the three dots in the upper right of the Dialogflow UI
then select "Create Fallback Intent"
The Fallback Intent editor is very similar to the normal Intent editor. The biggest difference is that the phrases you enter (and you don't need to enter any) will explicitly not match this Intent, and there are no parameters. Other aspects (the name, the Incoming Context, turning on fulfillment) are the same.
Upvotes: 2
Reputation: 6800
You need to create 2 intents, in the first intent your training phrase would be Ask me a question
, output context will be save_response
and response will be the question which you want to throw at the user.
Then in intent 2, you need to do following:
save_response
, so that it will only be
triggered when this is present in the contexts answer
, give entity type as @sys.any
Hope it helps.
Upvotes: 8