# Triggers

<figure><img src="/files/5jEzKptLoTmPCNbM7qDL" alt="Trigger Selection in Workflow studio" width="375"><figcaption><p>Trigger Selection</p></figcaption></figure>

### Available Trigger Types

* **App**: Creates user-facing applications (forms or chat interfaces)
* **API Call**: Starts with a request from your application
* **Schedule**: Runs on a recurring schedule or at specific times
* **Integration**: Triggers based on events from external applications

> 💡 You can have multiple triggers for multi-step workflows, but your primary trigger determines the publishing state of your workflow.

### How to Add a Trigger

1. Open the canvas in the Workflow Studio
2. Locate the box that says "What starts this workflow? Select an action trigger"
3. Click on the box to see the available trigger options
4. Select your preferred trigger type (App, API Call, Schedule, or Integration)
5. Configure the settings specific to your selected trigger

### How to Switch a Trigger

1. Look for the icon in the top right corner of your trigger action (arrows pointing right and left)
2. Click on this icon to open the trigger selection menu
3. Choose from the four available trigger types to replace your current trigger
4. Configure your new trigger as needed

> 💡 Switching triggers allows you to easily change how your workflow starts without rebuilding your entire automation.

<figure><img src="/files/BHWAo3bfD8qaDcQNQ1P1" alt="" width="375"><figcaption><p>Workflow Type Switching</p></figcaption></figure>

### App Trigger — URL Parameters

App triggers support **URL parameters** that let you pass input values directly through the app URL. This is useful for pre-filling forms, passing context from external systems (like an ERP or CRM), or creating dynamic links that customise the workflow for each user.

#### How URL Parameters Work

Parameters use **bracket notation** under the `i` namespace:

```
https://app.lleverage.ai/<orgId>/w/<workflowId>?i[fieldName]=value
```

For example, to pass a machine type and model:

```
https://app.lleverage.ai/xukfwbfwk/w/y8jbih5h?i[machine]=ficep&i[model]=coolaid
```

> 💡 Only parameters under the `i[...]` namespace are passed to the workflow. Other query parameters (e.g. analytics or tracking tags) are safely ignored.

#### Accessing URL Parameters in Your Workflow

URL parameters are available as an output of the App Trigger node:

* **`urlParams`** — A key-value object containing all parameters passed via the URL

You can reference these values in downstream nodes using expressions like `{{appTrigger.urlParams.machine}}`.

#### Automatic Form Pre-filling

When your workflow contains a **Form** node after the App Trigger, URL parameters are automatically matched to form fields by name. If a URL parameter key matches a form field name, that field's default value is set to the URL parameter value.

**Example:** If your form has a field called `machine` and the URL contains `?i[machine]=ficep`, the form will pre-fill the machine field with "ficep" when the user opens the app.

Key behaviours:

* Parameters that match form field names are injected as defaults
* Parameters that don't match any field are silently ignored
* URL parameter values override any existing default values on the form schema
* Values are treated as literal strings — template expressions in URL parameters are not evaluated (this prevents accidental data leaks)

#### Multiple Parameters

You can pass multiple parameters by chaining them with `&`:

```
?i[machine]=ficep&i[model]=coolaid&i[notes]=urgent
```

#### Use Cases

* **ERP integration**: Link directly from your ERP system with article numbers or order IDs pre-filled
* **Custom links per client**: Generate unique URLs with client-specific defaults
* **QR codes**: Encode parameters into QR code URLs for scanning in warehouse or factory settings
* **Email campaigns**: Include pre-filled links in emails to streamline data entry

> ⚠️ URL parameters are visible in the browser address bar. Do not pass sensitive information (passwords, API keys, secrets) through URL parameters.

### API Call Triggers

API Call triggers allow your workflow to be initiated by external applications through API requests, enabling programmatic access to your automations.

#### How to Configure an API Call Trigger

1. Select "API Call" as your trigger type
2. Click "Add Field" to create input parameters for your API
3. Enter field names and select appropriate data types
4. Under "Authentication," select either "Lleverage API Token" (recommended) or "None"

> ⚠️ If you publish with Lleverage API Token enabled, you'll need to specify this in your embedded code using your organization's settings.

<figure><img src="/files/JEcQPC5yfvsGB9S3mzft" alt="" width="368"><figcaption><p>API Trigger</p></figcaption></figure>

### Schedule Triggers

Schedule triggers run your workflow automatically at specified times or intervals without any user interaction.

#### How to Configure a Schedule Trigger

1. Select "Schedule" as your trigger type
2. Choose between "Specific Time" or "Intervals"
3. **For Specific Time:**
   * Set the hour and minute
   * Select AM or PM
   * Choose the date
4. **For Intervals, select a frequency:**
   * Every 5, 10, 15, or 30 minutes
   * Every 1, 2, 4, 6, or 12 hours

> 💡 Scheduled triggers allow your workflow to run automatically without manual intervention.

<figure><img src="/files/o36fKe0Lu8yFa1DMSJcz" alt="" width="375"><figcaption><p>Spcific Time Schedule</p></figcaption></figure>

<figure><img src="/files/kKmDyfqODGMVAtazi781" alt="" width="375"><figcaption><p>Intervall Time Schedule</p></figcaption></figure>

### Integration Triggers

Integration triggers start your workflow based on events from external applications, such as receiving an email or when a new file is added to a folder.

#### How to Configure an Integration Trigger

1. Select "Integration" as your trigger type
2. In the "Search App" field, type or scroll to find your provider (e.g., Gmail)
3. Select the provider from the list
4. Choose an action that will trigger your workflow (e.g., "New Sent Email")
5. Complete the authentication by selecting "Online Authentication"
6. Configure any optional properties provided by the integration

### What Happens When You Publish

Your choice of trigger determines what your workflow will become when published:

* **App triggers** publish as standalone applications
* **API Call triggers** publish as API endpoints
* **Schedule triggers** publish as scheduled tasks
* **Integration triggers** publish as integration-driven automations

### Key Features

* Each trigger has a natural language description to help you understand its function
* Triggers can be enabled or disabled to prevent unforeseen workflow runs
* Easy switching between trigger types without rebuilding your workflow
* Built-in variable creation for App and API Call triggers

> ⚠️ Understanding variables is important when working with App and API Call triggers, as they create output variables that can be used throughout your workflow.

> 💡 For detailed configuration of Form and Chat canvas actions, see the dedicated Form Actions and Chat Actions documentation pages.


---

# 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.lleverage.ai/canvas-actions/triggers.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.
