> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fapost.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Flow templates

> Describe a reusable piece of a dialogue once and place it in flows as one block.

A flow template is a reusable piece of a flow — "call an operator", a survey,
"rate the answer" — described once and placed in flows as **one block**.

## Creating a template

Templates are created in the console under **Templates**, next to **Flows**, and
edited in the builder like a flow. A template:

* belongs to an assistant. A flow can use only its own assistant's templates;
* counts under the plan's flow limit;
* cannot be started on its own. It is not offered as the default flow, as a
  `start_flow` command target or as a subflow target, and it has no trigger.

A template has exactly one starting block and cannot contain another template. A
subflow block inside a template is allowed.

## Outputs

Inside a template, a **Template output** block is a named exit. The name uses
lowercase latin letters, digits and `_` and starts with a letter; the label is what
authors see. Several outputs with the same name are one exit.

An output ends a branch of the template, so it has no connections after it.

> [!WARNING]
>
> **End** inside a template still ends the whole conversation. It is not an exit —
> use a Template output to hand control back to the flow.

## Using a template in a flow

Add a **Template** block and pick a published template. Its connections are the
template's outputs. The inner blocks are not visible or editable from the flow;
**Open template** opens the template. An output with nothing connected ends the
session there.

## How it runs

When the flow is published, the Template block is expanded into a copy of the
template's current published version inside the flow's published version. It runs in
the **same session** as the flow: there is no child session, no timeout and no paused
parent.

Variables are shared with the flow. The template reads `flow.*` and `contact.*`, and
what it writes the flow reads afterwards — this is how a template returns data.

> [!WARNING]
>
> A template overwrites a flow variable of the same name. Publishing rejects only
> type conflicts, so choose variable names that will not clash.

Texts are translated in the template itself, on its **Content** tab, and are the same
everywhere the template is placed — unless the template makes them parameters.

## Parameters

A parameter lets each flow that places the template set its own value for one setting
of a block inside it: "Looking for an operator…" in one place, "Looking for a
manager…" in another, without a copy of the template.

**In the template.** Open the settings of a block and, under **Template parameters**,
choose a setting, give it a key (lowercase latin letters, digits and `_`, starting with
a letter, unique in the template) and a label. A parameter can be a text, a number, a
choice, a toggle, a duration or a list. Settings that hold buttons or other nested
structures, and the settings of Loop, Template output and Template blocks, cannot be
parameters.

**In the flow.** The Template block's settings show each parameter with the same
control as in the template's block. While a parameter has no value in the flow, a toggle, choice,
duration, list or flow picker shows the template's own value in the control, marked
**Template value (inherited)**. Single-line text, a number and the state picker show it as
a placeholder, and multi-line text shows a **Template value: …** line under the field. Changing the control sets a
value of the flow's own. A value
set there replaces the template's value in this flow's copy; an empty value keeps the
template's value, and **Reset to template** empties it again.

**Translations.** A message text set as a parameter is typed in the base language in
the Template block and translated on the **flow's** Content tab. The value replaces the
template's text with all its translations: languages the flow does not translate fall
back to the flow's base-language text, not to the template's translations. A language
the flow leaves blank keeps the template's text in that language, and a text the flow
leaves empty keeps all of the template's translations.

## Editing a template

Publishing a template automatically republishes every flow that uses it, from each
flow's currently published version. Unpublished draft changes of those flows are
**not** published. Those flows get a new version number.

Conversations already running continue on the version they started with; new
conversations get the new copy.

A flow keeps the parameter values it set. A changed template text reaches only the
flows that leave that parameter empty.

If the new version would break a flow — an output the flow continues from was
removed, a parameter the flow sets was removed or renamed, or a variable type
conflicts — the template publish is refused with the list
of flows and the reasons. The builder shows where a template is used and warns before
publishing ("updates N flows").

## Deleting a template

A template cannot be deleted while a flow uses it, whether in a published version or
in a draft.

## Template or subflow

| | Template | Subflow |
| - | - | - |
| Session | Same session as the flow | Separate child session |
| Variables | Shared with the flow | Its own `flow.*`; values passed in and taken back by mapping |
| Exits | Named by the template | Fixed: success, cancelled, failed |
| Timeout | None | Yes |
| Version used | Copied at the flow's publish; edits republish the flow | Latest published version at start |

Use a template to reuse a piece of the dialogue inside one conversation. Use a
subflow for a self-contained flow that runs on its own and reports back.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.