Step 5: Create the account type logic

Now that we've created our passages, we need to direct the conversation flow to them. We'll do that by adding Logic.

Logic is a special type of passage: it doesn't send any message content itself. Logic exists to direct the flow of conversation:

  • Regular chatbot passages direct the conversation flow with buttons, Quick Replies, or scripts that lead to specific passages, or with Questions that the chatbot matches against the user's replies.
  • Logic passages direct the conversation flow based on conditions, such as whether a variable is set to a specific value.

You can direct the conversation flow to Logic with Questions, buttons, and other Logic, just like a regular passage. When the conversation flow reaches Logic, the chatbot assesses all the defined conditions and performs the appropriate action.

In this guide, we're going to use Logic to send our user to the correct credit card application passage based on the account type variable that was set in the welcome passage:

  1. Open the Create section of the left-hand navigation.
  2. Click Conversations.
  3. Click the Card Application conversation.
  4. Click the Logic icon to create new Logic in the conversation.
  5. Rename the Logic to Credit card application triage.

Create the first Logic tab to handle customers with personal accounts:

  1. In the Logic 1 tab, change the name to Personal account
    You don't need to rename the tab, but it makes it easier to understand what your Logic is doing.
  2. Leave the If dropdown to the default setting of all.
    We're defining just one condition, so both any and all will work.
    If you add more than one condition in a Logic tab, use this setting to define whether all the conditions must be true for Logic to choose this tab, or if any of the conditions must be true.
  3. In the next dropdown, select the AccountType variable you created earlier.
  4. Leave the middle dropdown set to an equals sign.
  5. In the last field, type Personal.
    Values must match conditions exactly, including capitalisation and spaces. Make sure this matches the value you saved to the variable earlier.
  6. In the Then section, select the personal credit card application passage you created earlier.

Now create a second Logic tab to handle customers with business accounts:

  1. Click the + at the top of the tab to create a new Logic tab.
    Logic tabs are checked from left to right. The chatbot chooses the left-most tab where the conditions match, even if other tabs would also match.
  2. In the new tab, change the name to Business account.
  3. Leave the If dropdown to the default setting of all.
  4. In the next dropdown, select the AccountType variable you created earlier.
  5. Leave the middle dropdown set to an equals sign.
  6. In the last field, type Business.
    Make sure this matches the value you saved to the variable earlier, including capitalisation.
  7. In the Then section, select the business credit card application passage you created earlier.
  8. In the Else section, leave the default setting of Create New Passage.
    The Else section defines what the chatbot should do if none of the Logic tabs match their conditions. In our example, this means what the chatbot will do if the AccountType variable value doesn't match Personal or Business.
    We'll handle what the chatbot should do here once we've finished our Logic.
  9. Click Save.

The Logic creates connections to our two credit card application passages. It also created a new passage. This passage was created by the Else section, which we left to the default configuration. In a moment, we'll use that new passage to handle what should happen if our AccountType variable isn't set.

We've created an AccountType variable, and Logic that uses the variable to direct the conversation flow. Now, we need a way to direct the conversation flow to the Logic in the first place. That's our next step: let's add some Questions to our Logic.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.