---
title: Workflow Builder
---

# Workflow Builder

Workflows provide a structured framework for defining conditional logic that enables dynamic collection of data on mobile devices.

![Workflow Explorations Overview Screenshot](../../assets/images/workflows-overview@2x.webp "Workflow Explorations Overview Screenshot"){ srcset="../../assets/images/workflows-overview.webp 1x, ../../assets/images/workflows-overview@2x.webp 2x" }

### Explorations

Explorations are a way to organize workflows. Simply put, they are a place to group related investigations or "explorations". They have a Title, and can be deleted at any time.

!!! warning
    Deleting an exploration will _stop and delete_ any workflow it contains.

![Workflow Explorations Screenshot](../../assets/images/workflows-explorations.png "Workflow Explorations Screenshot")

!!! Note
    When creating an Exploration, an [Exploration Report](reports.md) will be automatically created. It will collate all the outputs, from all the workflows, that are part of an Exploration.

### Workflows

A workflow represents a graph that consists of one or more flows. The Capture SDK continually processes incoming logs and aims to advance each flow within the workflow. As logs are received, they are compared against the ongoing match conditions within each flow. If a match is found, the relevant action is triggered, and the flow progresses to its subsequent state. In the case of a terminal node, the flow returns to its initial state.

From the perspective of a single workflow, this implies that it outlines a sequence of 'steps' that logs must follow to execute the intended actions. Each flow can begin with a different step, which allows a workflow to have multiple entry conditions. 

!!! Note
    Every terminal match condition should have attached at least one action for a workflow to be considered valid.


![Workflow Screenshot](../../assets/images/workflows-workflow@2x.webp "Workflow Screenshot"){ srcset="../../assets/images/workflows-workflow.webp 1x, ../../assets/images/workflows-workflow@2x.webp 2x" }

#### Workflow Lifecycle

As workflows are first sent to the clients, they are in an inactive state, waiting for the Capture SDK to process a log that matches any of the workflow's initial state conditions (i.e., any of the match conditions on the first step in a flow). Once an initial match is found, the workflow becomes active within the flow that matched. If the initial step of multiple flows are matched, all of those flows will be concurrently active.

While the workflow is active, the SDK continuously processes logs to see if it can progress any of the active flows and also checks if the initial step conditions for any of the flows are met. The SDK first considers any progress that can be made based on the log that was just received, and progresses a flow if possible. If no progress has been made but the initial conditions of a flow are met, that flow is reset and then progressed based on the log that matched the initial conditions.

Flows continue to progress until they reach a terminal state (i.e., no further matching can be done), at which point they will be reset and wait for the initial conditions to be met again.

!!! Note
    Workflows are also reset as part of the session lifecycle. When a session ends, all active workflows are reset.


#### Sharing and URL Slugs

To share a workflow, you can simply copy and paste the full URL. The workflow URL is created using slugs, which are formed by combining the workflow's title with a unique ID. A slug is the part at the end of a URL that makes it easy to identify a specific page on a website. If you edit the title, the URL slug is automatically updated to match the change. Importantly, both the old and new URLs will still work after the update.

## Workflow Expiry (TTL)

Workflows have a default expiration policy (Time To Live) to ensure unused configurations do not remain deployed indefinitely. **By default, a workflow expires after 30 days of no usage.** Usage is defined as any time a user views data from the workflow, such as rendering a chart in an Exploration Report or on the Workflow page.

Configuration is primarily used to adjust this time period to suit specific needs. You can shorten or lengthen the duration, or explicitly disable the TTL entirely if the workflow must remain permanently active regardless of usage.

!!! note
    Adding an alert to a workflow automatically disables the TTL, so you do not need to worry about expiration for workflows used for alerting.