# Workflows

Workflows power your automations and A-to-B integrations. Workflows feature a visual programming interface that enables flexibility and ease of use. Workflows can run every time a new record is synced or on a schedule. Workflows can be manually executed.

{% hint style="info" %}
ENTERPRISE customers can create a new account by going to the **Accounts** tab and clicking **+ New Account**
{% endhint %}

## Key Concepts

#### App Connection

An app connection facilitates the connection between a Middle account and a Middle app. An app connection contains the following parts:

* **Authentication** The credentials, tokens, and keys that are allowing Middle to access a web application
* **Syncs** The functions that grab and store data from a web application
* **Actions** The functions that can be used in a workflow
* **Stored records** Records synced and stored in Middle

#### Triggers

Triggers automate your workflows. There are two types of triggers:

* **Activity-Based Workflow Triggers** Configured for an app connection record type. These trigger when records are updated and created via syncs.
* **Scheduled Workflow Triggers** Trigger a workflow daily or hourly.

Triggers have discard logic for record filtering and requeue logic to accommodate for when related records neeeded for the workflow execution have not yet been sync.

Triggers do not log an execution history. As a result they are far more efficient for filtering than decision nodes. Discard logic should be used when possible to avoid unnecessary workflow executions.

#### Steps

A workflow is composed of steps. There are four step types:<br>

* **Begin** This is where your can input a synced record type and other global variables passed in by the trigger
* **Decision** Branch and filter a workflow
* **Action** Executes a function, such as an API call to another application. Actions have inputs and outputs. Outputs can be referenced as global variables.

#### Variables

Variables are dynamic data that can be accessed within a workflow. There are two types of variables:

* **Global Variables** Workflow-wide variables from the ouput of the Begin step or Action outputs
* **Special Variables** Conditional variables primarily from embedded arrays

#### Arrays

An array is a data structure that stores a list of elements, typically of the same type, where each element is accessible by an index. Middle is able to accommodate arrays within synced data and Action inputs and outputs.

Middle features a number of [array manipulation tools](https://docs.middle.app/middle-docs/broken-reference) to access, filter, and transform arrays.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.middle.app/middle-docs/building-workflows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
