# Flows

Flows are the processing pipelines that move data between your systems and your trading partners. Each flow is a chain of nodes that fetch, transform, route, and deliver EDI documents or JSON data. Flows are built automatically from your partner configuration.

## Directions

Every flow has a direction:

- **Inbound**: EDI documents flow from your trading partner to your system. A typical inbound flow fetches files from a connection, converts EDI to JSON, extracts individual transaction sets, and delivers the results to your webhook.
- **Outbound**: JSON data flows from your system to your trading partner as EDI. A typical outbound flow receives JSON via the partner API endpoint, maps it to the partner's specification, generates EDI, and uploads the file to the partner's connection.

## Flow Status

Flows have two statuses:

- **Active**: the flow is live and processing documents. Inbound flows fetch files automatically on their configured schedule. Outbound flows accept and process API submissions.
- **Pending**: the flow is built but not yet processing. Inbound flows on a pending status do not fetch files on a schedule, but can still be triggered manually. Useful for testing before going live.

A new inbound flow starts pending, so activating it is the step that starts fetching. A new outbound flow starts active, since it only receives what you submit.

To change a flow's status, expand the flow on the **Flows** card of its partner's page, choose **Pending** or **Active**, and click **Save**. **Edit** on the flow detail page also changes it.

## The Flow Builder

The flow detail page displays a visual canvas showing every node in the flow and how they connect. Data flows left to right through the pipeline.

Each node on the canvas shows:

- Its type (input, transformation, splitter, branch, sink, or output)
- The service it performs (e.g., SFTP Fetch, EDI to JSON, Webhook)
- The resource it references (e.g., a connection name or mapping name)

Click a node to view or edit its configuration.

## Node Types

Flows are composed of six kinds of nodes, each with specific services:

**Input**: entry points that bring data into the flow.

- SFTP Fetch: polls an SFTP connection for files
- AS2 Endpoint: receives files via AS2
- EDI Endpoint: receives EDI files submitted over HTTP to the inbound flow's endpoint
- Partner Endpoint: receives JSON submissions via the partner API

**Transformation**: process or convert data as it moves through the flow.

- EDI to JSON: parses raw EDI into structured JSON
- Mapping: applies a JSONata transformation to reshape data
- Implementation: validates and generates EDI from JSON using a partner's specification
- Pass-through: forwards data unchanged

**Splitter**: fans one incoming payload out into multiple downstream payloads.

- Transaction Set Extractor: splits a multi-transaction interchange into individual documents

**Branch**: routes data conditionally.

- Transaction Set Branch: directs documents to different paths based on their X12 transaction set type (e.g., 810, 856)

**Sink**: terminal node that consumes a payload as a signal to dispatch a side effect. Sinks cannot have children.

- 997 Acknowledgment: automatically generates and sends a 997 functional acknowledgment for inbound EDI

**Output**: delivers processed data to external systems.

- SFTP Upload: sends files to an SFTP connection
- AS2 Upload: sends files via AS2
- Webhook: delivers results to an HTTP endpoint

## Processing

**Inbound flows** run on a schedule. The process frequency determines how often Tediware checks the connection for new files. Options are every 5, 10, 15, 30, or 60 minutes depending on your subscription tier, or **Paused**. A paused flow stays active but is not processed automatically; you run it yourself. You can always click **Process**, on the partner's **Flows** card or the flow detail page, to trigger an immediate run, including on paused or pending flows.

**Outbound flows** are triggered when you submit data to the partner API endpoint. There is no schedule: processing begins as soon as data is received.

Every processing run generates a trace GUID that links all results through the entire pipeline, useful for debugging and audit trails.

## Inbound Flow Settings

Inbound flows have three additional settings. Change them by expanding the flow on the partner's **Flows** card, or with **Edit** on the flow detail page:

- **Schedule**: how often the flow checks for new files (every 5, 10, 15, 30, or 60 minutes), or **Paused** to stop automatic processing while keeping the flow active, and the minute it starts at. Available frequencies depend on your subscription tier. A flow that runs every 15 minutes starting at :08 runs at :08, :23, :38 and :53. Starting at :00, a flow runs on the clock boundaries (:00, :15, :30 and :45 for a 15-minute flow), which is when a VAN or a partner's server tends to be busiest. Pick a later starting minute when your partner asks you to connect at other times. The starting minute is always less than the frequency, and switching to a different frequency in the app sets it back to :00. Pausing a flow keeps its starting minute for when you resume it. Minutes are counted in UTC, which matters only in a time zone that is 30 or 45 minutes off the hour.
- **After fetching**: **Keep files** or **Delete files**, whether to remove files from the connection after they are successfully fetched and processed. A flow that keeps files reports a file more than four times your account's processing limit once, then does not fetch it again unless it changes on the server.

A flow that uses a sandbox connection or a sandbox webhook is always Paused and cannot be processed automatically. Run it manually with **Process** while you are testing.

## Building Flows from Partners

Flows are built from your partner configuration. The **Flows** card on the partner detail page has a row for the inbound flow and one for the outbound flow. Each row shows the flow's status, or **Build flow** if the flow does not exist yet.

**Build requirements:**

- Internal envelope assigned
- External envelope assigned
- Connection assigned
- At least one transaction setting for that direction
- For inbound: an inbound webhook configured

If any requirement is missing, the build button is disabled. Expand the row to see what still needs to be configured.

**Rebuilding:** Changes to a partner's configuration reach a flow only when you rebuild it, so live traffic is unaffected until you're ready.

When a flow is rebuilt, its status, frequency, offset, delete files setting, and tags are preserved from the previous version.
