Filters

Image of an author
Sylwia Kocur
10 min read
updated: Oct 30, 2023

Filters allow you to decide if and when the bot sends a specific answer to users.

When to use filtersLink icon

Filters enable you to decide what type of bot responses and actions are triggered depending on the user information your bot collects. For example, based on the applied filter, you can show a different message to a returning customer or someone who entered your website through a specific URL.

How filters workLink icon

There are four different types of filters:

  • Attribute — enables you to use default or custom attributes.

  • Score — uses the confidence score value to decide what action or response the bot should trigger.

  • Message — triggers the action based on user input.

You can apply multiple filters to a single bot response or action. Bot responses or actions are shown to the users only if the query meets the criteria in the filters.
You can apply multiple filters to a single bot response or action. Bot responses or actions are shown to the users only if the query meets the criteria in the filters.

How to use filters - examplesLink icon

In this part of the article, you’ll see how to use filters in 4 situations, each setting a different condition.

Message - based on matching systemsLink icon

You want to use a chatbot to help your customers (in this case, students and teachers) find good books. You need to create different conversation paths for customers looking for student books and users who are looking for teaching resources.

  1. Click on the Bot response block to open its edit window.

  2. Write in your welcome message.

  3. Drag the User input block and drop it after the Bot response.

  4. Click on the added User input block to open its edit window. Write all the possible variations of the messages your users might write on chat in the User says and Keywords sections.

  5. Drag the Filter block from the Actions and Interactions menu and drop it after the User input block. Add another Filter block after the same User input to create an additional path.

  6. Click on the added Filter block to open its edit window. Click Add new filter to choose the type of parameter your bot will apply to filter users. As you want to filter the kind of message your users will write on chat, select Message.

  7. Choose the condition. For this task, choose the contains option. This way, you can ensure that your bot will reply adequately if the user’s message includes the word or a phrase you provided. Write the word or phrase that should trigger the bot responses (“teach”) in the Value field.

  8. Add the second filter’s condition. This time, use the “student” keyword.

  9. Drag the Bot response block and add it after the Filter block. Choose the response you want to display after the query meets the filter’s conditions.

  10. Add another Bot response after the second Filter block. Choose the type of response you want to send to the second group of users.

  11. Test your Story to check if everything works as intended.

The Source attributeLink icon

You can use a default attribute if you’d like the Story to start from a specific flow. The widget will load, and the Story will start based on the condition you set in the filter.

  1. Create a Story. If you’d like to start the Story in a specific place, you need to place filters right after the Start point.

  2. Configure the filter’s condition. You need to click on the +Add new filter button. Next, you need to choose the option from the list. You can also add your custom attribute.

  3. After you choose the Source attribute, select its condition and provide the value.

  4. The best practice for using the Source attribute is the contains option. This way, you do not need to use the full URL address; you can use part of it. 

    In this example, type in “sales.” The Story will start with this path from any page that contains the “sales” phrase in the URL address. 

  5. In the second filter, type in “contact.” The Story will start with this path from any page that contains the “contact” phrase in the URL address. 

  6. Publish your Story and you can test how it works.

  7. Test your Story; use the Preview page. The page is available in the Chat Widget integration section right next to the Test your bot button. 

  8. Click the Live Preview option in the upper right corner.

To test if the filters work, you need to add “#?sales” and “#?contact” as the last element in the URL. You should add them separately.
To test if the filters work, you need to add “#?sales” and “#?contact” as the last element in the URL. You should add them separately.

The Email attributeLink icon

The Email attribute collects the email addresses that your users provide and saves them. You can use the addresses later in the Story using the attribute mentioned. The attribute is also kept within each User section, so the bot already has the email address when returning. 

You can use the Email attribute to differentiate the paths for new and returning users. For that, you’d need to use the Segments feature. 

In this case, you must create a segment before creating the Story. This way, while you build your Story, you already have a place to keep all of the email addresses the users will provide while chatting.

  1. Go to the Settings section of the Dashboard and create a segment.

  2. Name the segment “returning users”.

  3. Create the Story. You can return to the Dashboard and choose the field to create a new Story. 

  4. In the next step, ask the user to provide their email address. You can do that using the Question action. 

    Using this action provides you with an additional layer of security - the bot will ask the question again if the user provides the email address in the incorrect form.

  5. Within the Question action, ask for the email address. Please make sure to use the Email validation and the Email attribute.

  6. Add Filters. Add one filter for each of the user types. Add a Bot response after the filters, so you’d know if the bot chose the correct path. 

  7. Let’s see how it works. If the user is chatting with the bot for the first time, their email address can’t be in the Segment. That is why, in the Filter configuration, choose the “isn’t equal” condition.

  8. After this filter, add the Segment action. Choose the Add to segment action for that.

    This way, when the new user provides their email address, the bot will add the address to the segment. When the user returns to the chat, the filter will check if an address is already in the segment.

  9. Within the action, choose the correct segment and save.

  10. You have a different message for the users who chatted with the bot before, so you need to choose the second condition, “equals”. Select the equals condition because the email address is already in the segment in the user’s chats.

  11. Let’s test it. Remember to publish the Story before you start testing. Click the Publish button for that.

  12. Test the Story using our Preview page. The page is available in the Chat Widget Integrations section. Just click below the widget so you could test it live.

To test the settings correctly, you need to access incognito mode and open the Test it live link there.
To test the settings correctly, you need to access incognito mode and open the Test it live link there.
  1. Provide an email address that isn’t in the segment yet.

  2. Check the segment as well.

  3. Provide the email address again. This time, the address is already in the segment so the message will be different.

The Pre-chat form from LiveChatLink icon

In the previous example of filters, you can see how to use the Email attribute and show different paths to the users who come to the chat for the first time and to the returning users. 

In that example, you used the Question action. In this example, you can use the Pre-chat form from LiveChat - a short form that the widget will display once the user starts the chat. 

Let’s get to it then. 

  1. Go to the LiveChat app and find the Pre-chat form section. Choose the Email element from the list.

  2. Check the Required box field. This way, the user will be obligated to provide you with the email address before the chat starts.

    See how the question will look live on the right side of the screen. Test it live by clicking on the Test it live option below the widget. 

  3. Once the user provides the email address, it is sent to ChatBot in an attribute form. The form of the attribute depends on the question you ask in the pre-chat - if you use the generic email field in LiveChat, the attribute will be sent as the Email attribute.

    Head over to the Story. The same as in the previous example, we will use Segments. You can check above how to create a segment and use it.

    After you create a segment, start to develop the Story. Start by checking if the email address provided in the pre-chat is already in the segment. 

    For that, place two filters at the very beginning, just after the Start point.

  4. To make it happen, delete the Welcome message placed as a default - right-click on the block and choose the Delete single block option.

  5. After you add the filters, it is time to add conditions. Like in the previous example - use “equals” for the returning users and “isn’t equal” for the first-time users. 

  6. Next, it is time to add the first-time user to the segment, so they can be a returning user the next time they chat with the bot.

    Add the Add to segment action after the new user’s filter. Add a message so you’d know if this works.

  7. Choose the correct segment and save.
    chatbot filters

  8. When the returning user approaches the chat, the bot will show different messages based on the email address provided via the LiveChat pre-chat survey. 

Remember to publish the Story. The new version of your Story will be available to use once you click the Publish button.
Remember to publish the Story. The new version of your Story will be available to use once you click the Publish button.
  1. To test this Story connect the bot to LiveChat. Once you integrate the Story with LiveChat, go to the LiveChat app and see if your settings work.

  2. Test the bot on the Sample page. The page is available under the Chat Widget section - click on the Test it live option. 
    chatbot testing tool

To test the settings correctly, you need to access incognito mode and open the Test it live link there.
To test the settings correctly, you need to access incognito mode and open the Test it live link there.
  1. After the LiveChat preview page loads, open the widget. As you can see, the pre-chat form is on, and it contains the required field, Email. Provide the email address and start the chat.
    live chat pre chat form

  2. The bot should show the correct message for first-time users.
    chatbot widget

  3. Check the ChatBot Archives to ensure that the bot saved the email address correctly.

    As you can see on the right side of the screenshot, the email address was saved as a default_E-mail attribute. Also, the segment now contains the email address.
    chatbot archives

Collected information is passed to ChatBot as default attributes with the “default_*” prefix. In this case, the email address will be saved as the Email attribute as well. You can use them both in your Story.
Collected information is passed to ChatBot as default attributes with the “default_*” prefix. In this case, the email address will be saved as the Email attribute as well. You can use them both in your Story.
  1. Provide the same email address. The widget saved the email address provided the last time you chatted and the displayed message is different than the one the bot sent before.

Was this article helpful?

Got it!

Thanks for your feedback.

Thank you!

We’re happy to help.

Start a free ChatBot trial
and build your first chatbot today!

Free 14-day trial No credit card required

Discover our text| products