# Respostas aleatórias no bot

Para enviar respostas aleatórias aos clientes, configure as opções abaixo. Você pode usar frases inteiras, palavras individuais, números ou anexos.

No caso de ser necessário enviar uma frase, as opções de resposta precisam ser escritas no formato <mark style="color:vermelho;">**{**</mark>**text1**<mark style="color:vermelho;">**|**</mark>**text2**<mark style="color:vermelho;">**|**</mark>**text3**<mark style="color:vermelho;">**}**</mark>, por exemplo:&#x20;

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

Como o bot funciona:

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

### Enviando um anexo aleatório:

Para exibir um link aleatoriamente, a lista de URLs precisa ser escrita no formato \
**\<link1>**<mark style="color:vermelho;">**<$>**</mark>**\<link2>**<mark style="color:vermelho;">**<$>**</mark>**\<link3>**, exemplo:&#x20;

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

&#x20;Teste do bot:

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

### Enviando um número aleatório:

Para gerar um número aleatório, chame a `random` função com limites inferior e superior e atribua isso a uma variável. Em seguida, exiba o valor em uma mensagem do bot referenciando a variável dentro de `#{}`.

**Exemplo:**

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

Teste do bot:

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

### Enviando uma frase aleatória:&#x20;

Para potencialmente reduzir o risco de ser bloqueado em transmissões do WhatsApp, é recomendável variar levemente o conteúdo da sua mensagem para cada destinatário. Você pode automatizar isso usando chaves `{}` e a barra vertical `|` para definir variações aleatórias de texto dentro de uma frase. Exemplo:

<mark style="color:vermelho;">**{**</mark>**Oi**<mark style="color:vermelho;">**|**</mark>**Olá**<mark style="color:vermelho;">**}**</mark>. Quero vender meu programa de treinamento.

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

Respostas do bot:

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

### Enviando uma resposta aleatória:

Vamos tomar um exemplo de como enviar um comentário selecionado aleatoriamente a um cliente **no Instagram**.

O **select\_random('str1|str2')** o método é responsável por selecionar uma string aleatória

onde  **str1 e str2** - são variáveis nos valores das quais as opções de resposta são escritas.

Para enviar uma resposta a um comentário abaixo de uma publicação em que o cliente comentou - **insta\_create*****\_*****comment("str")**

onde **str**  - é a variável com o valor do resultado obtido pelo **select\_random** método.

{% hint style="info" %}
Você pode usar qualquer outro método de envio de mensagens em vez de 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/doc/pt/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.
