Skip to navigation

Subflow within Workflows

The Subflow feature introduces reusable and loop-based execution within workflows. Instead of restricting workflows to linear execution, Subflows allow workflows to dynamically redirect execution to another node within the same workflow while preserving workflow context and execution state.

Benefits of Subflows

Bundle repeated nodes

Bundle repeated workflow nodes into reusable execution units, and reuse common logic without duplicating workflow branches.

Redirect execution

Redirect workflow execution dynamically to another node in the same workflow.

Repeat until done

Repeat sections of workflows until conditions are met.

Keep state

Maintain workflow variables, counters, API responses, and execution state across iterations.

This allows workflows to behave dynamically instead of following rigid sequential execution paths.

Subflows are especially useful for:

  • Authentication recovery
  • Retry handling
  • Polling workflows
  • Conversational journeys
  • Bulk operations
  • Reusable API orchestration

Example

Say a customer asks to block all their cards, and the number of cards is only known when the workflow runs. One Block card step inside a Subflow loops once per card, keeps count, and the user is notified once at the end.

Subflow looping to block each card

Creating and Configuring a Subflow

Here is a subflow being named in the Subflow editor.

Naming a subflow

1

Open the Workflow Builder

Navigate to the Workflow Builder where reusable or loop-based execution is required.

2

Add the Subflow widget

Add the Subflow widget from the workflow builder sidebar.

3

Create the subflow

Click CREATE SUBFLOW to open the Subflow editor window.

4

Name it

In Subflow name, provide a unique and descriptive name, for example Authentication Retry Flow.

5

Add the nodes

Build the reusable subflow by adding workflow nodes after Start, such as API calls, conditions, wait steps, notifications, variable updates and authentication handlers.

Call API → Condition → Wait → Notification
6

Add a Loop or Redirect

Add a Loop or Redirect node wherever the workflow execution should repeat, and configure:

  • Continue conditions
  • Retry conditions
  • Exit behavior
  • Target node for redirection

This allows the workflow to dynamically jump back to earlier nodes while preserving workflow state.

7

Set the loop count

TypeDescription
Static ValueFixed number defined manually.
Dynamic ValueValue determined during runtime using workflow variables or node outputs.

The maximum supported loop count is 20.

8

Define the fallback

Define what happens when retry limits are exceeded, conditions fail, APIs continue failing, or loop conditions are no longer satisfied. For example: exit the workflow, send a notification, trigger an alternate flow, or log a failure event.

9

Store the payload (optional)

Optionally store payload data returned from the subflow. The payload is stored in JSON format and can later be accessed using workflow variables.

10

Save

Click DONE to save the subflow configuration. The reusable subflow is now available within the workflow. To remove it, click DELETE.

To update the subflow later, click the Subflow widget and select the Edit icon. You can insert the saved subflow wherever reusable execution logic is required within the workflow.

Use Cases

Long-running workflows often depend on authentication tokens for downstream API execution. During workflows involving waits, retries, or asynchronous processing, tokens may expire before the next API call executes. Without a recovery mechanism, downstream APIs may fail and interrupt customer journeys.

Using Subflows:

1The workflow validates whether the authentication token is still active.
2If expired, execution redirects back to the authentication node.
3The workflow generates and validates a fresh OTP.
4The access token is refreshed.
5Workflow execution resumes from the original flow path.

The same reusable flow can also handle OTP retries by redirecting execution back to the authentication step until retry limits are reached.

Benefits: eliminates duplicated authentication branches, improves workflow reliability, simplifies retry management, and preserves execution context during retries.

Outcome

The Subflow feature enables workflows to become significantly more dynamic, scalable, and maintainable. By supporting reusable execution paths, looping behavior, retry handling, and workflow redirection, builders can create workflows that adapt to real-time conditions instead of relying on rigid sequential execution.