typebot.io
typebot.io copied to clipboard
Loop (Iteration) Block
Problem / Motivation TypeBot currently has no native mechanism to repeat a sequence of blocks. Builders are forced to:
- Duplicate blocks manually
- Inject custom JavaScript
- Abandon certain use-cases altogether A first-class Loop Block will let flows iterate over a list or repeat utntil a condition is met, unlocking multi-item data capture, retry logic, dynamic surveys, and more.
Proposed Solution Add a Loop (Iteration) Block that can wrap any sub-flow and execute it repeatedly based on one of three modes:
- Fixed Count:
iterations = n; exits when counter reaches zero - For-Each:
list = varArray; exits when end of array - Until Condition:
continueIf = expression; exits when expression evaluates tofalse
Builder UX
- Drag-and-drop "Loop" container; creators can next blocks inside.
- The side panel shows a loop model dropdown and configurable parameters.
- Visual badge displays current mode, e.g.,
For-Each.
Runtime behavior
- Maintains loop index (
loop.index,loop.item) in conversation state. - Supports a break via a "Break Loop" exit inside nested blocks.
- Hard guardrail
maxIterationsto prevent infinite loops.