Sometimes I see questions like these in the Dialogflow forum.
So, I got one intent working. How can I now “move” the conversation to the next intent?
In Intent1, declare an output context called contextA. In the next intent you want to fire, use contextA as the input context. You have now chained Intent1 and Intent2 using contextA.
Is that all?
There is quite a bit more. But that’s the basic idea for every intent you are trying to chain into the conversation.
A practical example
I need to get three values from the user – their given name, their last name and their zip code.
I will be using the naming convention I mentioned in my previous post.
Step 1: The Welcome Intent
As soon as the user says Hi, the Default Welcome Intent will respond with a question asking for the user’s given name. The output context is set to awaiting_first_name
Step 2: Get first name
In the next intent, we get the first name. We use awaiting_first_name as the input context, and set awaiting_last_name as the output context.
When the user types in their first name, since the awaiting_first_name input context has already been set, and considering that the user’s input matches the expected pattern (i.e. they typed in something which can be recognized as the first name), it triggers the UserProvidesFirstName intent.
Can some other intent possibly fire during this step?(Hint: Yes) Read my article about intent candidate selection and leave a comment on what you think.
Step 2: Get last name
In the next intent, we get the last name. So here, we set awaiting_last_name as the input context and set awaiting_zip_code as the output context.
Just like in the previous step, if the user types in something which can be identified as a last name, the UserProvidesLastName intent will be triggered.
Step 4: Get Zip Code
Finally, we will get the zip code in the next intent. Here, we set awaiting_zip_code as the input context, and since we don’t wish to collect any more inputs from the user, the output context will be left blank.
Can’t I use follow up intents to get the same result?
Yes, you can. In fact, what I have described here is not very different from the way followup intents work under the hood.
But before you use followup intents, read the situations where you cannot use follow up intents.
And finally, learn the technique I have described here anyway, because you will most likely end up using it once you find that your bot cannot be completely built using followup intents alone.
- Actions Builder vs Dialogflow CX
- 5+ ways Dialogflow CX is better than Dialogflow ES
- How to bulk upload training phrases for Dialogflow Messenger
- Dialogflow CX vs ES: First look
- How to send rich responses from webhook to Dialogflow Messenger
- Dialogflow CX now generally available
- Dialogflow CX Missing Features
- Dialogflow Messenger integration for CX: First look
- Dialogflow Conversation Analytics Tips
- A simple method to evaluate multiple bot frameworks