Using Filters in Flow XO

Lydia Husser
Flow XO
Published in
8 min readMar 5, 2017

In Flow XO, filters are a great way to customize how your chatbot responds to user input. In this tutorial, you’ll learn what filters are and some practical ways to use them.

If you don’t already have a free Flow XO account, get yours now.

With filters, your chatbot can account for changeable information. You can respond to input with a tailored action.

For instance, you might want to make a chatbot that helps users plan a trip. Your chatbot needs to gather information about where and how the user wants to travel. Then it will make recommendations based on this information.

Filters

You might want your trip planning chatbot to recommend a place to stay based on where the user is traveling. You can do this with filters:

  1. In your flow, Ask a Question to find out where the user wants to go.
  2. Below that, click +, and select Bot for your service. Then select Send a Message for your action.
  3. In your message, respond to a choice the user might make. For instance, if the user wants to go to Africa, list recommendations for places to stay in Africa. Click Next to continue.
  4. Click +Filter, and set up a filter to make sure your chatbot will only go to this response if the user answers “Africa”. The empty Filter looks like this:

Your filter should look back to your original question, and check for the choice “Africa”. To tell your chatbot to check the answer to your question, the next step is to add a Value.

Filter Values

In the filter window, the Value is where you tell your chatbot where to look and what to look for. In this case, you want your chatbot to look in the question you just asked your user (“Where do you want to go?”). To set this up:

  1. In the Value box, type {{, and find your question in the drop-down.
  2. Select the type of user input to check for. In this case, we gave the user a list of choices, so check for a Choice.

Your filter should look something like this:

Now you need to tell your chatbot which choice to look for. To do this, you need to set a Condition.

Conditions

Within a filter, a Condition tells your chatbot what to check for when it looks in a Value. Your chatbot will do a filtered action when the Value aligns with the Condition.

You’ve already told your chatbot to look for the answer to “Where do you want to go?” Now you want your response to display only if the user answers “Africa”.

In other words, if “Where do you want to go?” Equals “Africa” your chatbot should use this response. So, set your Condition to Equals.

The Condition Equals requires a second Value. Here is where you tell your chatbot what choice to look for, in this case “Africa”. Your filter will look like this:

This response will only display if the user answers your question with “Africa”. Click Next, then Save to finish the response.

Filters with Multiple Conditions

To make your responses even more useful, you can gather several pieces of data from the user. You can then use filters with multiple conditions to respond with what the user is looking for.

At this point, you’ve asked your user where they want to go. Now you want to make travel recommendations based on where they are coming from. To set this up:

  1. In your flow, Ask a Question to find out where the user is traveling from.
  2. Send a Message based on a possible answer from the user. For instance, the user might be traveling from Asia to Africa. When you’ve added your message, click Next.
  3. Click + Filter.

Now you need to create a filter that will only display this response if the user is traveling from Asia to Africa. Because you want to match the output from two questions, you need to use the And condition in your filter.

Using the And Condition

The And condition tells your bot to match everything inside a group. In the Filters window, a group is a set of values and conditions surrounded by a gray box.

In this case, your filter should match both of these choices:

  • Where do you want to go? = Africa, And
  • Where are you traveling from? = Asia

Set the first Value and Condition. This will look the same as the filter you made earlier:

Now, click +AND. This will display an empty Value and Condition. Tell your bot to look in the question “Where are you traveling from?” and check if it equals “Asia”:

You can use add more And conditions if you need to.

Note: When using And, avoid using two Values that can’t be true at the same time. For instance, the answer to “Where are you traveling from?” can’t be “Asia” and “Australia” at the same time.

Using the Or Condition

Use the Or condition when you want to respond in the same way to different user input.

For example, you might want to recommend the same mode of transportation if the user is going to Africa from Asia, or to Asia from Africa. In other words:

  • Where do you want to go? = Africa, And
  • Where are you traveling from? = Asia

Or

  • Where do you want to go? = Asia, And
  • Where are you traveling from? = Africa

Instead of creating a new message, you can reuse the existing message by adding an Or condition. Click + OR, then add your values.

The whole filter should look like this. Note that each Or condition is in a separate gray box:

Filtering Numbers

Filters can account for nearly any kind of user input. It’s often useful to gather numbers from users. You can set you filter to check a numerical value.

For example, you might have a special rate for groups of 5 or more people. Find out how many people the user is traveling with, and offer the large group rate if it applies. To do this:

  1. Ask a Question to find out how many people are traveling. Set Validation to Integer. This will tell your chatbot to expect a number from the user.
  2. Create a response to offer the large group rate. Set your filter to check for a number greater than or equal to 5.

Your filter will look something like this:

If the user is traveling in a group of 5 or more people, your chatbot will offer the large group rate. If the group is smaller, the chatbot will move on to the next action.

Stop the Rest of the Flow

You may have noticed this checkbox at the bottom of the Filters page:

Check this box to tell your chatbot to stop the flow after it does the current action. This is useful if the action will meet the user’s needs, but your flow continues for users with other needs.

For instance, a user might indicate that they are not ready to make travel reservations. You can end the flow there, while continuing it for users who are ready.

Use a Filter on a Trigger

In the above examples, you placed each filter on an action within the flow. Your chatbot will only do the action if conditions are met.

You can also place a filter on a trigger. The difference is that your chatbot will only start the flow if conditions are met. Also, instead of checking the output from previous actions, you can only filter output from the trigger itself.

You might have a Google Sheet with deals for certain destinations. You can set up a new flow that only triggers if your user sets the destination to “Spain”, for instance.

Follow these steps:

  1. Set up your Google Sheet of holiday deals.
  2. Go to the Flows page and click + New Flow.
  3. Set up a flow with a Google Sheets New Row trigger.

Now set up your filter:

  1. On the Filters page, click + Add a Filter.
  2. Make a filter that looks for the row “Spain” in your Google Sheet.

The whole flow will only trigger if the “destination” field in the Google Sheet contains “Spain”.

Conclusion

In this tutorial, you’ve learned how to use filters to look back to an action and check for specific values. You also learned how to use And/Or conditions, account for variable numbers, and use a filter on a trigger.

Flow XO offers even more ways to customize your responses. You can gather and filter data like date & time, contact information, age, and budget. Then you can set up your chatbot to book an entire trip!

Want to find out more? We have full documentation for Filters and other features in Flow XO over at our Help Center, or get help & advice from other Flow XO users on the Community Site.

--

--