> For the complete documentation index, see [llms.txt](https://docs.chatlayer.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chatlayer.ai/chatlayer-documentation-pt-br/buildabot/tips-and-best-practices/reuse-flows.md).

# Reutilizar fluxos

Para muitos bots criados em nossa plataforma, a resposta à pergunta de um usuário depende das informações que você sabe sobre esse usuário. Essas informações, como o tipo de cliente que ele é, o tipo de assinatura que ele tem e assim por diante, podem ser coletadas por meio de uma API, mas também diretamente no próprio fluxo.

Por exemplo:

![](/files/bbebba1058801b4c3c77ef994ffc9167100df841)

No fluxo acima, a resposta à pergunta do usuário depende do tipo de cliente que ele é. No entanto, o tipo de cliente é importante para a resposta de muitas perguntas diferentes que um usuário pode ter. Não queremos mostrar a mesma pergunta toda vez que nosso usuário fizer uma pergunta como essa. Em vez disso, queremos armazená-la em um só lugar.

Neste tutorial, você aprenderá como criar um fluxo reutilizável, como acioná-lo e como retornar ao ponto original no fluxo.

1. Crie um bloco que se vincule a um intent que precisa de uma resposta específica. Vincule este bloco com um 'Go To' ao fluxo que você deseja reutilizar. Adicione uma variável do tipo bloco e dê a ela um nome, como "reuseFlow", e vincule-a a um bloco para retornar quando o fluxo terminar.

{% hint style="info" %}
Você pode criar dois tipos de variáveis em nossa plataforma: variáveis de texto, que permitem armazenar dados na sessão do usuário, e variáveis de bloco, que permitem armazenar uma variável.\
Leia mais sobre variáveis [aqui](broken://pages/88adc3005e539a863d5e8169aba21855faaabcd6).
{% endhint %}

![](/files/fb98987ea653911b2642c59c74dbd6f2cecb995d)

2\. Crie o fluxo que você deseja reutilizar e colete as variáveis de que você precisa do cliente

3\. No final deste fluxo, adicione um novo bloco de 'Action' e adicione um plugin 'Go to variable block'. Preencha a variável de bloco para retornar a este fluxo

![](/files/3b82a71128a25dd66a37e52229a659b30e6944b9)

4\. Quando um usuário chegar a esta parte do fluxo, ele retornará ao bloco original que foi definido na variável reuseFlow.

O fluxo usado no exemplo acima é assim:

![](/files/4660eb440103cbbc058981c35f925f8fba109f4e)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.chatlayer.ai/chatlayer-documentation-pt-br/buildabot/tips-and-best-practices/reuse-flows.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
