Chatbot survey with points awarded
You can use the builder to create a survey in the bot, with points awarded based on the client’s response.

For example, you can use a chatbot survey to test your users’ knowledge or for sociological and psychological research.
Flow settings
To make the survey quicker and easier, prepare the questions and answers in a regular document in advance:

Survey entry
In the builder, create a block with a condition ("Start block" or "Non-state with condition") that will serve as the starting point for the survey:

In the start block shown in the example, there is only a welcome message. Now you need to create the next block below it: to do this, open the additional settings menu and click the corresponding button:

Automatic transition
Next, go to the arrow settings and set a timer so that the first question is sent to the client automatically:

Starting the survey with a button
If you want the user to start the survey by clicking a button, create the corresponding buttons in the start block:
1. Go to the green block; 2. Click "Buttons" to expand the settings tab; 3. Click "+ Add button":

Enter the button text in the modal window that opens, then click "Add button":

Go to the arrow settings and check the box for the button in the condition:

This step ensures that the client moves to the next block only under a specific condition (in this case, the condition is the button text).
Set the match type to "exact match":

Questions and answers settings
Now let’s get to the most interesting part — setting up questions with answers. You’ll need your prepared script with the questions for this.
Step 1. In the block that the arrow from the start block leads to, paste the first question from your script into the message field:

Step 2. Next, create buttons with the response options depending on the number of answers (in the example, there will be 4 buttons):

Step 3. In the button settings modal window, enter the answer text and click "Add":

Important!
It’s not possible to use very long answer options on buttons in Telegram.
A workaround for Telegram: include the full answers in the message text and use shorter, concise text on the buttons:

If the answer options on the buttons are too long, the following error will occur:

Keep in mind the maximum character limit for buttons in Telegram.
Longer answer options, for example, can be used in an online chat on a website. ссылка
Add the required number of buttons to the block this way:

Step 4. Open the additional settings menu and create as many blocks as you have answer buttons for the question:

In the example, four blocks have been created for the four answer buttons:

Step 5. Go to the arrow settings and check the box for one button in the condition:

The arrow conditions should correspond to only one specific answer option from the client. This means each arrow’s condition must have exactly one button selected — the first arrow linked to the first button, the second arrow to the second button, and so forth.
The example shows that each arrow corresponds to only one button:

Step 6. Create the block below that the arrows from the four answer blocks will lead to:

Step 7. Set the timer to 0 seconds in the settings of each arrow leading to the same block:

Step 8. Then, enter the next question in the block that the four arrows lead to:

Create the answer options as buttons in the block with the second question, just like before:

Now, create four blocks below from the block with the second question. In the arrow conditions leading to these blocks, specify the corresponding answer options — basically, you’ll repeat steps 1 through 8: filling in the question field, creating the required number of answer buttons, and setting the arrow conditions to match the selected answers.

The example above clearly shows the repeated block settings for the questions. This is how all the questions and answers are filled in.
Step 9. You need to create the next question block. To do this, create a "State" block and connect the arrows to it:

This will create the third question block; now you can continue adding questions and answers following steps 1–9 as described.
It’s easier and faster to first create all the questions and their answer options, then assign variables for scoring. How to award points during the survey is explained next.
How to award points
Step 1. Go to the block with the first question:

In the calculator, declare a variable—for example, named "score"—and set its value to zero:

Step 2. Go to the block that the arrow from the answer leads to, and open the calculator:

Add the corresponding number of points to the variable in the calculator based on your script:

Add 4 points in the block connected to option A.

Add 3 points in the block connected to option B.

Add 2 points in the block connected to option C.

Add 1 point in the block connected to option D.

Do the same for the other blocks that the answer arrows lead to — add points to the variable based on the selected answer option:

Done! You’ve now created a chatbot flow with questions and point scoring for the client.
How to display the result?
Option 1. Display the result as text:
You can show the result using the variable #{score} in the final block that the arrows from the scoring blocks lead to:

This way, your user can clearly see the total points they’ve earned during the survey and compare their results.
Option 2. Calculator and IF operator
If you want to display a shorter, more concise result, use the calculator with an IF function:

In other words, you need to set conditions for the bot like: "if the score is less than 8, then you are a melancholic; if the score is between 8 and 11 inclusive, then you are a phlegmatic," and so on — but in the system’s syntax.
Here’s the code you can copy:
text = if(score < 8,
"You are a melancholic — shy, sensitive, prone to reflection and worry. You have deep emotionality.",
if(score >= 8 and score <= 11,
"You are a phlegmatic: calm, balanced, and thoughtful. You dislike fuss and prefer stability.",
if(score > 11 and score < 21,
"You are a sanguine: sociable, cheerful, and adaptable. You tend to take things lightly but get easily excited.",
"You are a choleric: energetic, impulsive, prone to sharp reactions. A leader, but sometimes lacks restraint."
)
)
)
The final flow looks like this:

Important! Blocks named "Awarding points" with an empty message #{none} are used solely to calculate points.

This is how the bot works:

Done! Now you know how to create surveys for messengers in a bot!
Last updated