> For the complete documentation index, see [llms.txt](https://docs.baas.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.baas.sh/baas-console/automations/actions.md).

# Actions

Choose what each step of the pipeline does, such as calling an API, sending an email, running code, notifying users, or submitting a transaction.

Actions are the steps of the pipeline: each one does one thing, and they run in order every time the trigger fires. You build them from the automation's **Pipeline** tab.

## Choose an action type

| Type                                                                  | What it does                                               | Typical uses                                            |
| --------------------------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------- |
| [**API**](/baas-console/automations/actions/api.md)                   | Sends an HTTP request to any HTTPS endpoint                | Push events to your backend, call a third-party service |
| [**Email**](/baas-console/automations/actions/email.md)               | Sends an email through your project's SMTP transport       | Order confirmations, alert emails, reports              |
| [**Function**](/baas-console/automations/actions/function.md)         | Runs your JavaScript in a sandbox                          | Format on-chain values, shape data for the next step    |
| [**Notification**](/baas-console/automations/actions/notification.md) | Pushes a notification to your users' devices               | Transfer alerts, transaction status updates             |
| [**Transaction**](/baas-console/automations/actions/transaction.md)   | Calls a smart contract function with a key from your Vault | Distribute rewards, mint tokens, write on-chain state   |

## Add an action to the pipeline

The **Add step** button sits below the pipeline, available as soon as the trigger is set. Click it and pick one of the five types: **API**, **Email**, **Function**, **Notification**, or **Transaction**. Fill in the type's form and click **Save**; the panel's footer reads "Ready to save" once every required field is in place.

New actions are named `Action 1`, `Action 2`, and so on; rename them from the panel's title. The type is chosen at creation and the configuration stays editable afterwards; for another type, add a new action.

Each saved action appears as a node in the pipeline, with its name and a one-line summary of its configuration. Reorder, pause, edit, or delete it right from the node: [Tune the pipeline](/baas-console/automations/manage-an-automation.md) covers those controls.

## Dynamic values

Most text fields accept `{{...}}` templates. Focus a field and the **Insert a variable** panel lists the variables you can use, matched to your trigger type; click one to insert it. The ones you'll reach for most:

| Variable           | What it holds                                                                                             |
| ------------------ | --------------------------------------------------------------------------------------------------------- |
| `trigger.*`        | [The data that started the run](/baas-console/automations/triggers.md#what-the-trigger-passes-to-actions) |
| `context.previous` | The previous action's result                                                                              |
| `context.eventId`  | A unique id for the current run                                                                           |

Invalid templates are flagged when you save. A variable missing from the run data fails the run. To allow a missing value, add a trailing `?`: `{{trigger.body.nickname?}}`. The [Reference](/baas-console/automations/reference.md) has every variable a run exposes and how templates render them.

## Chain actions together

Actions run from top to bottom. Each action's result becomes `context.previous` for the next active one. The first action starts without it, and an action you toggled off is skipped. For example, a [Function](/baas-console/automations/actions/function.md) can shorten a long transaction hash, and the notification that follows then reads `{{context.previous.shortHash}}` instead of the full one. Each type's page shows exactly what it hands to the next step. An action in [batch mode](/baas-console/automations/batch.md) produces one result per selected user instead of a single one, so `context.previous` is `null` for the next step.

## Email and Notification need a one-time setup

API, Function, and Transaction actions work out of the box. Email and Notification are backed by plugins you configure and activate once, in [Action Plugins](/baas-console/action-plugins.md). Picking a type whose plugin is inactive shows a **Plugin inactive** warning with an **Open settings** shortcut to fix it.

## When actions run

The pipeline runs on every firing, and each run lands in [Runs and logs](/baas-console/automations/runs-and-logs.md) with the outcome of every step; a failed action stops the run there. Actions you [toggle off](/baas-console/automations/manage-an-automation.md) are skipped.

## Next

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>API</strong></td><td>Set the URL, pick the method, and write the body.</td><td><a href="/baas-console/automations/actions/api.md">API</a></td></tr><tr><td><strong>Email</strong></td><td>Address it, then write the subject and body.</td><td><a href="/baas-console/automations/actions/email.md">Email</a></td></tr><tr><td><strong>Function</strong></td><td>Write the code and hand its result to the next step.</td><td><a href="/baas-console/automations/actions/function.md">Function</a></td></tr><tr><td><strong>Notification</strong></td><td>Pick the device tokens and write the message.</td><td><a href="/baas-console/automations/actions/notification.md">Notification</a></td></tr><tr><td><strong>Transaction</strong></td><td>Set up the contract call, then the key and the completion.</td><td><a href="/baas-console/automations/actions/transaction.md">Transaction</a></td></tr></tbody></table>
