Create a Sub-Flow That Can Be Re-Used in Teneo Studio – DZone AI | xxxCreate a Sub-Flow That Can Be Re-Used in Teneo Studio – DZone AI – xxx
菜单

Create a Sub-Flow That Can Be Re-Used in Teneo Studio – DZone AI

二月 29, 2020 - MorningStar

Over a million developers have joined DZone.

  • Create a Sub-Flow That Can Be Re-Used in Teneo Studio - DZone AI

    {{node.title}}

    {{node.type}} · {{ node.urlSource.name }} by

    Download {{node.downloads}}

  • {{totalResults}} search results

{{announcement.body}}

{{announcement.title}}

Let’s be friends:

1024)” dc-slot=”ads.sl1.slot(articles[0], 0)” tags=”ads.sl1.tags(articles[0], 0)” size=”ads.sl1.size(articles[0], 0)” style=”border:0px;”>
1 && !articles[0].partner.isSponsoringArticle && (width > 1024)” dc-slot=”ads.sb2.slot(articles[0], 0)” tags=”ads.sb2.tags(articles[0], 0)” size=”ads.sb2.size(articles[0], 0)”>

Create a Sub-Flow That Can Be Re-Used in Teneo Studio

DZone ‘s Guide to

Create a Sub-Flow That Can Be Re-Used in Teneo Studio

In this article, let’s learn how to build a sub-flow that can be re-used in Teneo Studio.

Apr. 07, 20 · AI Zone ·

Free Resource

Join the DZone community and get the full member experience.

Join For Free

What if there is a certain flow that you want to be using multiple times for you chatbot? In Teneo Studio, it is possible to use sub-flows.

That means that 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 address can be realized 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: franks@gmail.com
Bot: I have your email as franks@gmail.com. Is that correct?

User: no
Bot: Please enter your email address.

User: frank@gmail.com
Bot: Is your email address frank@gmail.com correct? Please confirm.

User: yes
Bot: OK, thank you! I’m adding your address frank@gmail.com to our mailing list. You will receive a confirmation mail shortly.

We will implement the conversation in two steps:

  1. Build the sub-flow
  2. Build the main flow

Build the Sub-Flow

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:

Create a Sub-Flow That Can Be Re-Used in Teneo Studio - DZone AI

Create a Sub-Flow

First, we will create a new flow and turn it into a sub-flow.

  1. Create a new flow and call it Get email address.
  2. In the ‘Flow’ tab, under ‘Variables’, add a flow variable called email and initialize it to empty string ""
  3. Click the arrow to return to the ‘Home’ tab
  4. In the ribbon bar of the ‘Home’ tab, click the ‘Sub-Flow’ button in the section ‘Flow Entry’. This will replace the default trigger with a blue dot

Add a Prompt for Email

  1. Select the output node and give it the output Please enter your email address.
  2. Name the output node Prompt for email
  3. With the output still selected, add a new output node to follow it
  4. Select the new transition and call it Email entered
  5. Make sure it is set to ‘Conditional’ and ‘Gets input before continuing’
  6. Add the condition %EMAIL_ADDRESS.SCRIPT^{email=_USED_WORDS}

Set up the Sub-Flow to Re-Prompt

  1. Select the second output and give it an answer I have your email as ${email} is that correct?
  2. Name the output node Confirm email
  3. Select the ‘Confirm email’ output node and using the mouse key, drag and drop a transition back to the output ‘Prompt for email’
  4. Make sure the transition is set to ‘Conditional’ and ‘Gets input before continuing’
  5. Call the transition Re-try and give it the condition %NO.PHR

Set up a Positive Confirmation of the Email

  1. Select the output node ‘Confirm email’
  2. Add a new output node to follow it
  3. Select the transition and make sure it is set to ‘Conditional’ and ‘Gets input before continuing’
  4. Paste %YES.PHR into the condition field and name the transition Confirmed
  5. Give the new output node a response OK, thank you! and rename the node Thank user
  6. Click save

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 show you how exactly to do that.

Build the Main Flow

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.

Create the New Flow

  1. Create a flow and name it User wants to subscribe to the mailing list
  2. In the ‘Flow’ tab under ‘Variables’, add a flow variable called email and initialize it to empty string “”
  3. Click the arrow to return to the home page
  4. Select the trigger, call it 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
  5. Select the output node and add an answer I'm happy to add you to receive our completely free newsletter.
  6. Call the output node Happy to add you to our mailing list

Add a Call to the Sub-Flow

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.

  1. Select the ‘Happy to add you…’ output node and add a ‘Flow’ node leaving it
  2. Name the transition Call sub-flow and make sure it is ‘Unconditional’ and set to ‘Continues without input’
  3. Call the ‘Flow’ node Get email address
  4. With the ‘Get email address’ node selected, make sure the sidebar area ‘Flow Link’ is visible
  5. Click ‘Browse’ and select our subflow ‘Get email address’
  6. Retrieve the email address from the subflow: in the section ‘From’ where you see ‘Get the value back’ select email from the dropdown list as illustrated here:

Finish the Flow

  1. Select the sub-flow node and add a new output node
  2. Call the transition Return from sub-flow and make sure it is ‘Unconditional’ and set to ‘Continues without input’
  3. Give the output an answer I'm adding your address ${email} to our mailing list. You should receive 
    a confirmation mail shortly.
  4. Call the output node Confirmation
  5. Hit ‘Save’

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 underlined 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: frank@gmail.com
Bot: I have your email as frank@gmail.com, is that correct?
User: Yes.
Bot: OK, thank you! I’m adding your address frank@gmail.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.

Topics:
conversational ai ,conversational ai chatbot ,artificia intelligence ,chatbots ,machine learning & ai ,chatbot development

Published at DZone with permission of Gareth Walters . See the original article here.

Opinions expressed by DZone contributors are their own.

AI Partner Resources

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.linkDescription }}

{{ parent.urlSource.name }}

by

CORE

· {{ parent.articleDate | date:’MMM. dd, yyyy’ }} {{ parent.linkDate | date:’MMM. dd, yyyy’ }}


Notice: Undefined variable: canUpdate in /var/www/html/wordpress/wp-content/plugins/wp-autopost-pro/wp-autopost-function.php on line 51