How to build a simple scoring bot system

Pau Sanchez Updated by Pau Sanchez

For many reasons, we might need to set up a score and redirect the flow based on the conditions. Here is how you can do it:

  1. Set up the first Question, with the different options you wan the user to choose:

  1. Now create a Set Variable block, where we will assing 1 point if the choose the first answer:

  1. Make sure the variable you created is Number type, in this case we call it @question1

  1. Now you will replicated the Set Variable block and connect it, with it's own value to the rest of options:

  1. After, we will connect all those Set Variable to the next question:

  1. Again, we will replicate the same process, BUT we will create it with a new variable name, in our case @question2:

  1. We continue, by replicating the process above, as many times as we need:

  1. Finally, we connect, all the outputs, from the last question set variables, to a Formula block, where we will Sum all the points, and store it in the variable @result (Number type):

In this case the Formula is a simple Sum:

Sum(@question1,@question2,@question3)

  1. In the next step we will Set up flows based on the points that are in the @result variable:

Here is a demo, of how it will be seen:

How did we do?

How to access keys and values, in object variables

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

Contact