Table of Contents

How to "debug" (troubleshoot) your bot's flow to spot possible errors (for non coders)

Pau Sanchez Updated by Pau Sanchez

In some occasions we might find that the bot is not going through the flow as we expected... Don't worry, we will teach here you how to debug your bot!

And you don't have to use any codes or be a developer in order to do it πŸ˜‰

(1) Find out WHERE the bot flow is stopping

First of all, you have to understand why the bot is crashing (obviously!). If you don't have it clear, run a few tests in your bot, and try to discover what feature or block in specific is not working as it should.

(2) Find out WHY the bot flow is stopping

Most of the times debugging is as simple as understanding the logic of your bot, and checking the values given to the variables 😊

To understand if the variables are correctly set, we must check the values of variables in the different steps of the flow.

You can understand what could be happening once you check the variables set in the bot and how you are using them after they are set 🧐

HOW TO debug the bot

Once you understand (1) where the bot flow is stopping, and (2) why your bot could be stopping, you can use some tricks to find out what is the problem, and finally debug your bot.

Here are 4 "tricks" that our Customer Support and developers use to find out possible problems 😎:

How to "debug" the simple way

The trick is adding a Send Message block right after the block we want to test. Insert the variable in the Message block, and run a test to see if the value is coming through πŸš€

  1. In this example, we could see that (1) the bot is crashing when reaching the Webhook block, and (2) we suspect it stops because one of the variables we need to collect is not coming through.
    We are using a variable called @variable_response.

  1. So we placed a Message block right after the Webhook block, testing the variable called @variable_response .

  1. Then we must test the bot. By running a test, we can see the variable's value, and make sure that is the value we expect.

In this step the variable is coming through correctly. So you just have to repeat this in the steps that might be problematic, in order to find the issue.

How to debug a full response from a Webhook

There are few cases when you are working with external API's responses that might be unexpected, and we need to SEE how they behave, so that we can accommodate the response and the bot accordingly.

This is what you should do to see the full response:

  1. Access the Save Response section inside of the Webhook block.
    Without selecting any key, write the name of the variable where you want to store the whole response. In the example below we used the variable @response

  1. Add a Send Message block, right after the Webhook block.
    Then add the variable you want to test to be displayed later in the test (in our example, @response ).

  1. Run a test with the bot in the site, to see the whole response. Then adapt the bot in the builder if necessary.

How to debug without displaying it to the end user if your bot is public

We have another trick if your bot is already active, and you need to debug it without displaying the variable to the end user πŸ˜ƒ

Instead of using a Message block, which would display the values of variable, you can use notification blocks like Email or Slack, where you send yourself the variables to test them.

You just have to type the variable in the text field, just like you would do using a Message block, but using the Email or Slack Notification blocks instead.

How to debug using a Conditions Block

In some occasions, we might visualise correctly a variable, and we know exactly the value... but for some reason we are not sure why it is behaving differently from what we expect πŸ‘»

To fix this, we can use Conditional Logic to compare if a variable is what we expect it to be.

You just have to use the Conditions block with the option "EQUAL TO" the value it needs to be. This is good idea to make sure we are not making a mistake somewhere else.

How did we do?

Guidelines πŸš€ 5 best practices for chatbot design in Landbot πŸ€–