# Validador de resposta a templates

### Modo de Configuração

1 - Copie o código abaixo e coloque ele no seu Fluxo de Boas Vindas.

```javascript
var resposta = context.cur_msg && context.cur_msg.text
resposta = String(resposta)
if (resposta === "Botão 1" || "Botão 2") {
    context.aceitado = 'ok';
    context.resposta = resposta
    console.log("passei")
}
else {
    context.aceitado = "nok";
}
```

2 - Após isso crie um filtro onde ele irá validar o **context.aceitado**.

<figure><img src="/files/0CC7OqOtwP8sVpGOhPak" alt=""><figcaption></figcaption></figure>

3 - Em seguida crie um Novo Fluxo à direita do filtro citado acima.

Nesse Novo Fluxo, você irá criar alguns filtros conforme a ação de cada botão. Onde ele ira validar os botões com a variável **resposta.**

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

4 - Configure a ação correspondida àquele botão embaixo de cada filtro.

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


---

# 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://help.cosmobots.io/help/outros/exemplos-de-codigos-javascript/validador-de-resposta-a-templates.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.
