Flow.ai Intermediate Tutorial - Looping Flows
Описание
In this video, we will show you how you can loop flows and in which situation this could be useful for your bot projects within Flow.ai. For more information about looping flows, visit our blog page: https://flow.ai/blog/kb-how-to-loop-flows
Feel free to join our Slack Support Channel: https://slack.flow.ai/
It's a great way to get answers and inspiration, together with around 1000 other bot builders!
Looping Flows - A Flow.ai Intermediate Tutorial
Looping flows means going back to an earlier part of the flow, or even going back to the start of that flow.
We will illustrate how looping flows works by creating a new flow for asking contact information from the user.
When we ask someone's name, we can save the given answer with the Any Text Trigger. Let's call this one “user.name".
For names it's not necessary to check whether the input is valid, so let's keep it on "should be any text”.
For emails, however, it is important to check the validity because you won't be able to contact an invalid email address.
So by picking "should be email address" you let the chatbot only accept the input if it looks like a valid email address.
If the chatbot thinks the input is invalid, the message will not match with the Any Text Trigger and goes into the Unknown.
After asking all the information we need, we can show the values we just saved so the user can check if it's correct.
Use the saved values of the parameters in your Text Reply by typing the parameter name between double curly brackets.
Let's also add Quick Replies to make it easier for the user to respond.
Because we already have an intent for Yes and No in this project, we will simply drag them in from the Intent Library.
Let's also add an Unknown Trigger for when someone says something that doesn't match with the Yes or No intent.
If we didn't do this, unmatched messages would trigger the Unknown flow in this project we made for an earlier tutorial.
If the user responds with Yes, we can forward the conversation to an agent, and we are done with this flow.
If the user says No, however, we must go through this flow again to fix the error.
Before looping the flow back to the part where we ask for the contact information, we must first reset the parameters.
Otherwise, the chatbot wouldn't overwrite the old values for the new values, but the parameters would have both.
That can sometimes be useful, for example for asking multiple names for a group, but it's not what we want in this case.
After resetting the parameters we use an Event Reply to go back to the beginning of this flow. That's called looping the flow.
Now let's save it and test it out. You can trigger events in our preview by clicking on the flag and sending the right event.
You can see during this chat that the saved values for the parameters are shown on the right side.
When we don't respond with something similar to Yes or No you can see the Unknown Trigger is working correctly.
It seems to work but we aren't done yet. We said that the Any Text Trigger for the email address should be an email address.
We have to add another Unknown Trigger for when the input isn't a valid email address, similar to what we did for Yes and No.
Here we can also reset the parameter for the email address, just to be sure the wrong one isn't also saved.
After asking for a valid email and resetting the parameter we must loop back to where we asked for the email address.
We already know the name of the user, so this time we should loop back to the point where we ask the email.
In order to be able to loop back to a specific place in your flow, add a new event at the pace where you want to loop back to.
You must also add an Event Reply with the newly made event just above the Event Trigger.
If you forget to do this, the flow would be stuck after the Any Text Trigger, because after that the new event doesn't get triggered.
Now you can loop back to the part of the flow where you ask the user's email address anytime by adding an Event Reply.
Our flow is done now so let's test it one more time to see what happens when we type an invalid email address.
And that's how looping flows works!
Sparkler by Roa Music | https://soundcloud.com/roa_music1031
Music promoted by https://www.free-stock-music.com
Creative Commons Attribution 3.0 Unported License
https://creativecommons.org/licenses/by/3.0/deed.en_US
Рекомендуемые видео



















