> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solya.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflows

> Automate responses to your data — create plans, add items, call webhooks, and send emails.

A **workflow** is an automation that reacts to your data and runs a sequence of actions.
You design it as a flow of nodes — a **trigger** plus one or more **actions** — and the
data platform executes it.

```mermaid theme={null}
flowchart TB
  T["Trigger<br/>entity type + tag filters"] --> A1["Create or get plan"]
  A1 --> A2["Add items to plan"]
  A2 --> A3["Call webhook"]
  A3 --> A4["Send email"]
  A4 --> R["Workflow run<br/>one step per node"]
```

<Note>
  For the **exhaustive, field-level** reference — every action's config, all strategies,
  credentials, interpolation, and the run/step model — see
  [Workflows (reference)](/en/developers/workflows/overview).
</Note>

## Triggers

A workflow is triggered by an entity type — **product, product variant, brand, or
inventory item** — optionally filtered by [tags](/en/automation/tags) (include/exclude).

## Actions

| Action                 | What it does                                                                                                                  |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **Create or get plan** | Create (or reuse) a plan — restock, rebalance, markdown, supplier return, or supplier exchange — with its scope and deadline. |
| **Add items to plan**  | Add items to a plan using entity filters, shop/size scope, and a quantity strategy.                                           |
| **Call webhook**       | Send an HTTP request (GET/POST/PUT/PATCH/DELETE) with optional auth, headers, and body.                                       |
| **Send email**         | Send an email (text / HTML / markdown) to recipients.                                                                         |

### Strategies for "add items"

* **Quantity**: **fixed**, **fill to target**, or **score-driven** (uses decision-vector
  recommendations).
* **Matching** (rebalance): **fixed** or **score-driven** (matches surplus shops to
  deficit shops).
* **Discount** (markdown): **fixed**, **score-driven**, or **recommended** (decision-layer
  discount with margin floor and caps).

Shop scope can be **all**, **specific**, or **from the trigger**; size scope can be **all**
or **below a stock threshold**. Dates (deadlines, markdown dates) can be **absolute**,
**relative** (days from now), or **interpolated** from earlier step outputs.

## Runs & steps

Each execution is a **workflow run** (pending → running → completed / failed / cancelled),
and each node produces a **step** record (pending, running, succeeded, failed, skipped,
cancelled) with its resolved inputs, output, logs, and retries — so you can see exactly
what happened.

A workflow itself has a status: **draft, active, paused, or archived**. Only active
workflows execute.

## Working with workflows

<Steps>
  <Step title="Open Workflows">
    Go to **Orchestration → Workflows**.
  </Step>

  <Step title="Design the flow">
    Add a trigger (entity + tag filters) and chain actions in the full-screen builder.
  </Step>

  <Step title="Activate">
    Set the workflow to active so it runs when its trigger matches.
  </Step>

  <Step title="Monitor runs">
    Review run history and per-step details to verify outcomes.
  </Step>
</Steps>

<Note>
  Webhook credentials are stored securely and referenced by the Call-webhook action, so
  secrets never live in the workflow definition itself.
</Note>
