How to use Builder's debug tool September 26, 2022 21:07 Updated Index: Accessing the Debug Tool Using Debug to analyze the conversation flow How to identify errors in the flow through Debug If your bot was built using Builder (Blip's visual bot-building tool), you can use the Debug tool to analyze all the behavior of your bot's flow. Through this tool it is possible to follow how the execution occurs in each of the blocks that make up the conversation of your application. To use Debug, it is necessary to have knowledge about how Builder works, and what are its main concepts: contents, conditions of exit and actions, of entry (Entering Actions) and exit (Leaving Actions). Accessing the Debug Tool After accessing a bot created through Builder, select the test option and then select the Debug option, as shown in the screen below. After clicking on the Debug option, Blip will open a new window with all the necessary resources to analyze the functioning of your application. Debug consists of 3 major areas: console, variables and test screen. 1. Console - Section responsible for displaying the entire route taken by the test user throughout the flow of the conversation. 2. Variables - Section that presents the current value of all variables of the test user in the debug. 3. Test screen - Section that represents the conversation interface for the Debug test user. Using Debug to analyze the conversation flow Once we understand the basic concepts for using the Debug tool, let's run a real example to evaluate how it can be useful in identifying problems in a conversation flow. To exemplify how it works, we will use a new bot, but you can use Debug for any existing bot. Access the portal, create a bot (from scratch), and publish the bot flow. Every bot created in Blip has, by default, 4 blocks: Start, Welcome, Exceptions and Standard Error (if your platform account is in English, the name of the blocks will be: Start, Welcome, Exceptions, Default Error). Access the Debug tool and send a message to the bot, for example: "hi". After sending the message, the bot will respond with the contents defined in the Welcome block (or Welcome) and the Console section will display everything that happened to the test user within the flow. Note that the path taken by the user was the transition between the Start and Welcome blocks (or Home and Welcome), executed due to the input of the user "hi". This behavior is described in the first line of the console. If you want to analyze exactly what all the actions (incoming or outgoing) were performed from a specific transition, expand the line in the console. In addition to the console section, note that the variables section now also has values related to the test user. In this case, only the previous-state and state-id variables, created automatically, have values so far. They represent, respectively, the last accessed block and the current user block. Continue sending messages through the test screen and analyze the changes that occurred in the console (related to the transitions between the blocks) and in the variables section. How to identify errors in the flow through Debug In practice, your bot may have errors during the construction process. Using the Debug tool, finding and correcting these problems is a much simpler task. To exemplify a problem in the flow, create an entry action of type Execute Script in the Welcome block of your bot with the following script: function run() { var person = null; return person.name;} After creating the action, republish the flow of your bot and return to the Debug screen. The script we just created has a basic error, trying to access the name property of an empty object. Therefore, when the Builder tries to perform this action, an error will occur. Imagine, for example, that this small oversight can cause problems in the flow of your application. Click the button to restart the test user in Debug and retake the tests. Now you will notice that the console will present an action with an error and the detail of what is causing this problem. Also note that the console lines are painted red whenever one or more actions related to this transition have errors. For more information, visit the discussion on the subject in our community or the videos on our channel. 😊 Related articles Creating interactive messages in WhatsApp Builder variables How to connect your chatbot on WhatsApp - 2ª version How to Save Contact Information Sending WhatsApp Active Messages on Blip Desk