# Random responses in the bot

To send randomized responses to clients, configure the options below. You can use entire phrases, individual words, numbers, or attachments.

In the case when it is necessary to send a phrase, the response options need to be written in the format <mark style="color:red;">**{**</mark>**text1**<mark style="color:red;">**|**</mark>**text2**<mark style="color:red;">**|**</mark>**text3**<mark style="color:red;">**}**</mark>, for example:&#x20;

<div data-with-frame="true"><figure><img src="/files/QfQaA11I8c1P8N74tm3b" alt="" width="375"><figcaption></figcaption></figure></div>

How the bot works:

<div data-with-frame="true"><figure><img src="/files/uhXm8GjAH4j1DgEt8z6g" alt="" width="375"><figcaption></figcaption></figure></div>

### Sending a random attachment:

To randomly output a link, the URL list need to be written in the format \
**\<link1>**<mark style="color:red;">**<$>**</mark>**\<link2>**<mark style="color:red;">**<$>**</mark>**\<link3>**, example:&#x20;

<div data-with-frame="true"><figure><img src="/files/gexoTM5UrGeJMQt0R8mb" alt="" width="375"><figcaption></figcaption></figure></div>

&#x20;Bot testing:

<div data-with-frame="true"><figure><img src="/files/hw5QjGpcQ42BGMf5yJ7j" alt="" width="375"><figcaption></figcaption></figure></div>

### Sending a random number:

To generate a random number, call the `random` function with lower and upper bounds and assign it to a variable. Then, output the value in a bot message by referencing the variable inside `#{}`.

**Example:**

<div data-with-frame="true"><figure><img src="/files/MUlIS4bwFWGrTVQacXPN" alt="" width="375"><figcaption></figcaption></figure></div>

Bot testing:

<div data-with-frame="true"><figure><img src="/files/FY5ZWjxiLqRNSzrkbfKP" alt="" width="375"><figcaption></figcaption></figure></div>

### Sending a random phrase:&#x20;

To potentially reduce the risk of being blocked in WhatsApp broadcasts, it's recommended to vary your message content slightly for each recipient. You can automate this by using curly braces `{}` and the vertical line `|` to define random text variations within a sentence. Example:

<mark style="color:red;">**{**</mark>**Hi**<mark style="color:red;">**|**</mark>**Hello**<mark style="color:red;">**}**</mark>. I want to sell my training program.

<div data-with-frame="true"><figure><img src="/files/JLikjE65W7rQ55PUWfms" alt="" width="360"><figcaption></figcaption></figure></div>

Bot's answers:

<div data-with-frame="true"><figure><img src="/files/RuCiLcdCRTa0beBMqCx2" alt="" width="443"><figcaption></figcaption></figure></div>

### Sending a random response:

Let's take an example of how to send a randomly selected comment to a client **on Instagram**.

The **select\_random('str1|str2')** method is responsible for selecting a random string

where  **str1 и str2** -are variables in the value of which the answer options are written.

For sending a response to a comment under a post that the client commented on - **insta\_create*****\_*****comment("str")**

where **str**  - is the variable with the value of the result obtained by the **select\_random** method.

{% hint style="info" %}
You can use any other method of sending messages instead of i**nsta\_create\_comment().**
{% 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/chatbot/builder/responses.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.
