AvantaHub Blog

Simplifying If/Then Bots in HubSpot Chatflows

Written by Team | May 23, 2023 4:38:11 PM

What are If/then Branches in HubSpot?

If/then branches are conditional statements used in programming and chatbot design in HubSpot to control the flow of a conversation based on specific conditions. They allow you to define different paths or actions for the bot depending on your set criteria.

When to utilize If/Then Code Branches in HubSpot?

To customize the flow of bot conversations, you can utilize if/then branches. By incorporating conditions, you can instruct your bot to follow specific actions based on the visitor's response, a contact property value, or your team's availability. Each quick reply response or bot action can have its own if/then branch.

Similar to workflow branches, if/then branches allow you to direct visitors along different paths based on predefined criteria. For instance, you can guide visitors to different bot actions depending on whether they answer "yes" or "no" to a question posed by the bot. This feature enables you to trigger distinct bot actions and tailor the conversation flow to each individual visitor, taking into account the information they provide.

To incorporate an if/then branch into a bot action and determine the subsequent action based on specific visitor criteria, follow these steps:

  • Go to the Conversations tab in the top bar. Choose Chatflows.
  • Choose the bot and choose the Edit option, or create a new bot.
  • Within the bot editor, pick an action.
  • On the right-hand panel, navigate to the If/then branches tab.
  • Click on the option to add if/then branch.

To establish conditions for this action, you can determine the logic based on the user's response, a contact property value, or agent availability. Follow these steps:

  • Click on the first dropdown menu to set your criteria:
  • Visitor's response: Utilize this option to direct visitors along a specific path based on their response. For instance, you can guide them to different bot actions based on whether they answer "yes" or "no" to the bot question.
  • Click the dropdown menu and choose a filter option.
  • Click on "Add values" and enter the desired values by typing them in, then press Enter.
  • Click on the dropdown menu labeled "Next action if all conditions are true" and select an action.


To direct a visitor along a specific path based on a contact property value, follow these steps:

  • Click on the dropdown menu labeled "Select a property" and choose the desired property.
  • Click the dropdown menu and select a filter option.
  • Click on the dropdown menu labeled "Add values" and choose the appropriate property values, or manually enter a value to create conditions. Press Enter to add it to your list.
  • Click on the dropdown menu labeled "Next action if all conditions are true" and select an action.



Another option is to redirect a visitor back to a previous action. Follow these steps:

When you click on the dropdown menu labeled "Next action if all conditions are true," select an earlier action from the available options.

By doing so, the contact will be directed to "loop back" to the previous step.


 

Your chatflow is ready to go live on your website. If you need any assistance, feel free to contact AvantaHub HubSpot experts.