# 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.

<figure><img src="/files/mSYIuC5UQM1Zjj9aUAzr" alt="" width="563"><figcaption></figcaption></figure>

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:

<figure><img src="/files/wXOUV0Ekiud3a4h5jOYv" alt=""><figcaption></figcaption></figure>

### 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:

<figure><img src="/files/VDcCYfk2GJkdbQ9Ro7iF" alt=""><figcaption></figcaption></figure>

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:

<figure><img src="/files/MO6MrrNw4Vu1FUbuqMVv" alt=""><figcaption></figcaption></figure>

#### Automatic transition

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

<figure><img src="/files/sMwGduAudHFp7COVrQfL" alt=""><figcaption></figcaption></figure>

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":

<figure><img src="/files/BR8DEr7VcFxL1FhFlksM" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/ZuptbYZWgJz77DL5BJzv" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/o8X4XzLMe79xXh45Lmvv" alt="" width="563"><figcaption></figcaption></figure>

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":

<figure><img src="/files/O39Ka045enm6hHxkN6Nk" alt="" width="563"><figcaption></figcaption></figure>

### 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:

<figure><img src="/files/CYQaXff81eQh6vfYMFhi" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/ZB4IrP8tiLHJc6RwnoFb" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/rfLkxaYc4bGMr8rfK37w" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
**Important!**&#x20;

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:

<img src="/files/5hwi9Es4vGriVITCMWk6" alt="" data-size="original">

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

<img src="/files/qfwkzprkYAz36XMDgx0W" alt="" data-size="original">

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. <mark style="color:red;">**ссылка**</mark>
{% endhint %}

Add the required number of buttons to the block this way:

<figure><img src="/files/pvnuOfHkZjRssanmDR5E" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/8dVexnVQtTbvEU8DuJMT" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/17fVIfb0GEyz4Zh71tPa" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/f1OXuWbqDfSsmGBu0idE" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
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.
{% endhint %}

The example shows that each arrow corresponds to only one button:

<figure><img src="/files/1RIFK4jCfB6z26YWEBMC" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/CoYOg6qVnsvdb1PcNscz" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/ENBYnGVYfSAsGNJkC3h0" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/UEbaULDDwVCaB1xxZ2Gy" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/bTyipBeySCUQW3yS4BoY" alt=""><figcaption></figcaption></figure>

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.

<figure><img src="/files/3JDMPTxmRX69H5IYjCdt" alt=""><figcaption></figcaption></figure>

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:

<figure><img src="/files/74PRMJ8cCtVfPUIMaxK9" alt=""><figcaption></figcaption></figure>

This will create the third question block; now you can continue adding questions and answers following steps 1–9 as described.

{% hint style="success" %}
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.
{% endhint %}

### How to award points

Step 1. Go to the block with the first question:

<figure><img src="/files/Vq5XdawTcnaU5Q8FUXB8" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/MarCahPeOjHrgQbSMAZx" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/TKOxesDgMOWPNTxSi5th" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/MsW5s93LuavVnhLvCsno" alt=""><figcaption></figcaption></figure>

Add 4 points in the block connected to option A.

<figure><img src="/files/DjeVMPfCK44eykOSmxMx" alt=""><figcaption></figcaption></figure>

Add 3 points in the block connected to option B.

<figure><img src="/files/Yd3w0I65gFg0QdMvly0A" alt=""><figcaption></figcaption></figure>

Add 2 points in the block connected to option C.

<figure><img src="/files/GJmnr3tyRrrIe1SDXZiY" alt=""><figcaption></figcaption></figure>

Add 1 point in the block connected to option D.

<figure><img src="/files/7pbRPHGC8d0LX8xOGKo6" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/FRVHqbljiH3G3ERuTEuA" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
Done!\
You’ve now created a chatbot flow with questions and point scoring for the client.
{% endhint %}

### 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:

<figure><img src="/files/kvoYV14T5IfS8PlkAymS" alt=""><figcaption></figcaption></figure>

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:

<figure><img src="/files/4gKMSGgZodH3Pjv1BTrw" alt=""><figcaption></figcaption></figure>

In other words, you need to set conditions for the bot like: <mark style="color:$warning;">**"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,"**</mark> 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:

<figure><img src="/files/JAdJzDFbhwcZSYJYKIyZ" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/yuqM99s9XdrpUNZbqeyt" alt=""><figcaption></figcaption></figure>

This is how the bot works:

<figure><img src="/files/qKf0XXCMTgO9ATtMaW8Q" alt="" width="375"><figcaption></figcaption></figure>

{% hint style="success" %}
Done!\
Now you know how to create surveys for messengers in a bot!
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mavibot.ai/how-to-do.../chatbot-survey-with-points-awarded.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
