How do subflows work? May 15, 2023 21:03 Updated Index: What are subflows? Rules and conditions for the use of subflows General characteristics of a subflow block: Control blocks in a subflow Content blocks in a subflow Options and restrictions in the Builder side menu Subflow testing and debugging Behavior of subflows in relation to other functionality Understand how subflows work and take advantage of the potential of this resource to optimize your conversational flows in Blip in an easy, fast and standardized way. IMPORTANT!This is an early version of the subflows functionality. We understand that there is a lot of potential for evolution. We are making this smallest possible version (MVP) available because we want to build it collaboratively, based on the use cases that you experience on a daily basis. Feel free to bring situations and possibilities not yet covered in this version, make suggestions and show how we can evolve the subflows. In this material, we will present the business rules (definitions, limitations) that make up this MVP. It is important to remember that they can be modified in the next versions. What are subflows? The subflows functionality is available to person users with access to a workspace from a Blip contract. Outside of a contract, you cannot see or use the functionality in the Builder. Rules and conditions for the use of subflows Find out below the main characteristics, rules and conditions for the use of subflows: Any member of an organization with permission to create and edit conversational flows and with access to a given chatbot will be able to view and edit that chatbot's subflows in Builder. A chatbot can have multiple subflows. It is even possible for more than one user to build and edit the chatbot simultaneously, as long as each one is editing a different subflow. A user person can insert blocks of subflows into the main flow build, while others can make edits or start building the flow that will be inside the subflow A subflow is not a chatbot. It's just part of the flow of a chatbot. Therefore, it has no context of its own, does not create a new contact, and cannot be published in a channel in isolation. The conversation with the chatbot that has subflows is considered unique. The contact or customer that goes through the flow and subflows of a chatbot in the same conversation will be counted as only one. Considering that subflows make up the same chatbot, the context between them (subflows and main flow) will also be unique. A variable defined inside the subflow will be accessible in the main flow and vice versa. This also means that a variable defined with the same name in the main flow and within the subflow will have its value overwritten by the last value defined in an action or from user person input. General characteristics of a subflow block: A subflow block can be created in the main flow of a chatbot. It is configured similarly to the other blocks: it is necessary to define the exit conditions (where the conversation should go after passing through the subflow) and entry and exit actions (actions to be performed when the conversation arrives or leaves the block). Furthermore, it is important to know that: When configuring an exit condition, the block of the main flow that will come after the conversation reaches the “End” block, which is inside the subflow, is defined. You can edit subflow information such as name, image, description, and tags. Just click “Configure Subflow” inside the block. The exit conditions and entry and exit actions are the same as those available today for a content block; Is it possible to delete a block of subflows. When deleting a subflow, the subflow tile will no longer appear in your chatbot flow, as well as the flow built within it. It is possible to undo the action of deleting it using the Ctrl+Z or Undo command. Control blocks in a subflow Unlike what happens in the main flow, the flow of a subflow has 3 control blocks: Start, Exceptions and End. The "End" block does not receive input from the user person. Nor is it assigned exit “conditions or entry” and exit actions. After the "End" block, the conversation follows the rules defined in the "Exit Conditions" section of the subflow block. The 3 control blocks cannot be renamed or deleted. It is possible to reference the control blocks in the output conditions of any other block. The "Start" block of the subflow allows you to wait for input from the user, but the default setting is not to wait. The other settings remain equivalent to the "Start" block of the main flow. The "Exceptions" block of the subflow has the same functioning as the "Exceptions" block of the main flow. The "End" block has the function of redirecting the conversation back to the main flow. Content blocks in a subflow Some particulars apply to content blocks that are in a subflow. Are they: Content blocks in a subflow only have output conditions of type “User Response” and “Variable”; The "Redirect to a service" and "Query content assist" actions are not available in a subflow. Options and restrictions in the Builder side menu In a subflow, Builder's left side menu will have the following possibilities and restrictions: It is possible to create content blocks. It is not possible to create Human Service blocks. It is not possible to create a subflow block inside another subflow. It is possible, however, to redirect the conversation between subflows through the output conditions defined in the subflow block. The main flow will always recognize the published version of the sub-flow (even when the main flow is editing). For an edit made in a subflow to take effect in the main flow, it is necessary to click on "publish subflow" in the left side menu of the Builder. As you build the subflow flow, your changes are automatically saved. Still, you need to publish the subflow for the changes to be reflected in the main flow (both for testing and debugging the flow). You can define specific variables for your subflows using configuration variables within the subflow. It is not possible to edit the rest of the variables as these are inherited from the main flow. You can consult the variables of the subflow in "My variables" in the "Variables library", located in the left side menu of the subflow. The subflow can use a context variable defined in the main flow. The opposite is also possible, that is, it is possible to access the value of context variables defined in the subflow in the main flow. You can access main flow configuration variables within subflows. The opposite is not possible. Only variables defined in the subflow will be visible in a subflow's Variable Library. Although it is possible to access configuration and context variables from the main flow when building or editing a subflow, they are not displayed in the subflow's variable library. The "Search" option in a subflow follows the same behavior and operation as the search in the main flow. It is possible to edit the General Settings. Subflow testing and debugging The only way to test the behavior of a subflow is to test the main flow. Whenever the main flow is tested – regardless of whether it's the published or under construction version of the main flow – you are testing the “published” version of the subflow. Hint: It is possible to do a targeting from the initial block to the subflows if you only want to test the subflow. You can debug the subflow seamlessly with the main flow, displaying both the main flow and subflow variables. Behavior of subflows in relation to other functionality Understand now how the subflow behaves when related to other Blip features: Router context Considering that the subflow shares the context of the main flow, if the router context is enabled in the main flow, the subflow will also be sharing the router context. “Context” of the main flow (access/definition of variables) It is not necessary to unify contacts, context variables and active users of the flow and its subflows. This information is already shared between flow and subflows. That is, the contact that talks to the subflow is the same one that talks to the main flow. Human transshipment The listening rules defined for the overflow are configured for the main flow. It is not possible to configure differentiated rules by subflow. The Human Service block can only be added in the main flow. Artificial intelligence Currently, it is not possible to use AI resources within subflows. Resources It is not possible to register resources for the subflow, but it is possible to use resources created in the main flow of the chatbot or in the router in the subflow. Analytics You can perform analysis of events recorded in subflows in reports generated for the main flow chatbot or for the router. When a conversation starts in a subflow, an automatic tracking event is triggered. For more information, visit the discussion on the subject in our community or the videos on our channel. 😃 Related articles How to import a bot flow in Builder Creating interactive messages in WhatsApp How to configure a destination block by variable How does redirection between subbots work? Exit Conditions in the Builder