Some flows may be re-used as parts of other flows. In Teneo, you can use sub-flows to do so. For example, requesting the user's email adress can be realised as a sub-flow that can then be used in larger flows. In the following, we will build both, the sub-flow and a flow that makes use of it.
This is how a conversation should look:
User: I'd like to subscribe to your newsletter
Bot: I'm happy to add you as a recipient of our free newsletter. Please enter your email address.User: teneo@example.com
Bot: I have your email as teneo@example.com. Is that correct?User: no
Bot: Please enter your email address.User: teneo@example.com
Bot: Is your email address teneo@example.com correct? Please confirm.User: yes
Bot: OK, thank you! I'm adding your address teneo@example.com to our mailing list. You will receive a confirmation mail shortly.
We will implement the conversation in two steps:
Our Sub flow to retrieve the user's email will ask the user to enter an email address, confirm with the user that the email was correct, and if correct, return the mail. If not correct, the user will be re-prompted. This continues until a correct email was entered. The final Sub flow will look as follows:
First we will create a new flow and turn it into a sub-flow.
Get email address
.email
and initialize it to empty string ""
.Prompt for email
.Please enter your email address.
Email entered
.%EMAIL_ADDRESS.SCRIPT^{email=_USED_WORDS}
.Confirm email
. I have your email as ${email} is that correct?
. Re-try
and add the following examples:
no
nope
nah
OK, thank you!
and rename the node Thank user
. Confirmed
and add the following examples:
yeah
yup
yes
That's it! We can now use this sub-flow that requests the user's email address in as many other flows as we want. In the next section, we will show you how exactly to do that.
At this point, we have a sub-flow that is not being used anywhere. Since it doesn't have a trigger, Teneo will never select it. In this section, we will build a flow to trigger if users request to be added to the Longberry Baristas mailing list. Later this flow will make use of the Sub flow 'Get email address' that we created above. But for now, we will just build the question and answer. We'll add the Sub flow link later.
User wants to subscribe to the mailing list
.email
and initialize it to empty string "".Subscribe to the mailing list
and add positive learning examples:
Can i get your newsletter?
How can i subscribe to the newsletter?
How to get on your mailing list?
I want to subscribe to your mailing list
I'd like to subscribe to the newsletter
Please add me to your mailing list
Please put me on the mailing list
Happy to add you to our mailing list
. I'm happy to add you to receive our completely free newsletter.
.Now we want to pass control to the sub-flow and let it do all the work of prompting the user for an email address.
Get email address
.Call sub-flow
and make sure it is 'Unconditional' and set to 'Continues without input'.Confirmation
.I'm adding your address ${email} to our mailing list. You should receive a confirmation mail shortly.
.Return from sub-flow
and make sure it is 'Unconditional' and set to 'Continues without input'.That's it! You may now give it a go in try out and replicate the conversation below. Note that the answer parts from the sub flow are italic for illustrative purposes. In practice, they will not be distinguishable from the answers of the main flow:
User: I want to subscribe to your newsletter!
Bot: I'm happy to add you to receive our completely free newsletter. Please enter your email address.
User: teneo@example.com
Bot: I have your email as teneo@example.com, is that correct?
User: Yes.
Bot: OK, thank you! I'm adding your address teneo@example.com to our mailing list. You should receive a confirmation mail shortly.
Note that if the name of the sub flow should change at some point, all existing connections between main flows and this sub-flow will automatically be updated by Teneo.
We're finally done with the Flows chapter. Next in line is conversations.
Was this page helpful?