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

# Trigger Nodes

Trigger nodes are special nodes that start flow execution. Every flow must have at least one trigger. A flow can have multiple triggers if you want to reuse the same integration logic in different scenarios.

<br />

## API Trigger

**Type:** `api-trigger`

The API Trigger allows you to launch a Flow Instance with optional input using your application's API or SDK.

```yaml theme={null}
trigger:
  type: api-trigger
  name: Manual Sync Trigger
  config:
    inputSchema:
      type: object
      properties:
        recordId:
          type: string
        syncAll:
          type: boolean
```

**Configuration options:**

* **`inputSchema`** – Optional schema that will be validated when the flow is triggered

**Output:**

The output contains the input provided when triggering the flow:

```javascript theme={null}
{
  recordId: '12345',
  syncAll: false
}
```

<br />

## Schedule Trigger

**Type:** `schedule-trigger`

The Schedule Trigger runs a flow at regular intervals as long as the Flow Instance is enabled.

```yaml theme={null}
trigger:
  type: schedule-trigger
  name: Hourly Sync
  config:
    intervalMinutes: 60
```

**Configuration options:**

* **`intervalMinutes`** – How often the flow should run (5 = every 5 minutes, 60 = hourly, 1440 = daily)

**Output:**

The output contains timing information:

```javascript theme={null}
{
  triggeredAt: '2024-01-15T10:30:00Z'
}
```

<br />

## Internal Event Trigger

**Type:** `app-event-trigger`

The Internal Event Trigger runs a flow when a specific event occurs in your application. Before using this trigger, you need to create an [Internal Event](/docs/managing-membrane/monitoring-troubleshooting/logs/internal-events).

```yaml theme={null}
trigger:
  type: app-event-trigger
  name: Order Created Event
  config:
    appEventKey: order-created
    filter:
      $eval:
        $var: $.payload.amount
      $gt: 1000
```

**Configuration options:**

* **`appEventKey`** – Key of the internal event to listen to
* **`filter`** – Optional filter to conditionally trigger the flow based on event data

**Output:**

The output contains the event payload:

```javascript theme={null}
{
  payload: {
    orderId: '12345',
    amount: 1500,
    customer: 'customer-id'
  }
}
```

<br />

## Data Record Created Trigger

**Type:** `data-record-created-trigger`

This trigger launches a flow when a new data record is created in a selected Data Source.

```yaml theme={null}
trigger:
  type: data-record-created-trigger
  name: New Contact Created
  config:
    dataSource:
      collectionKey: contacts
    fieldMapping:
      key: contact-mapping
      defaultValue:
        firstName:
          $var: $.rawFields.first_name
        lastName:
          $var: $.rawFields.last_name
        email:
          $var: $.rawFields.email
```

**Configuration options:**

* **`dataSource`** – Specifies which [Data Source](/reference/workspace-elements/data-sources) collection to monitor
* **`fieldMapping`** – Optional [Field Mapping](/reference/workspace-elements/field-mappings) to transform data from the external app to your app's format

**Output:**

The output contains information about the created record:

```javascript theme={null}
{
  id: 'contact-123',
  name: 'John Doe',
  url: 'https://app.com/contacts/123',
  fields: {
    firstName: 'John',
    lastName: 'Doe',
    email: 'john@example.com'
  },
  rawFields: {
    first_name: 'John',
    last_name: 'Doe',
    email: 'john@example.com'
  }
}
```

<br />

## Data Record Updated Trigger

**Type:** `data-record-updated-trigger`

This trigger launches a flow when an existing data record is updated in a selected Data Source.

```yaml theme={null}
trigger:
  type: data-record-updated-trigger
  name: Contact Updated
  config:
    dataSource:
      collectionKey: contacts
    fieldMapping:
      key: contact-mapping
```

**Configuration options:**

* **`dataSource`** – Specifies which [Data Source](/reference/workspace-elements/data-sources) collection to monitor
* **`fieldMapping`** – Optional [Field Mapping](/reference/workspace-elements/field-mappings) to transform updated data

**Output:**

The output contains the updated record data in the same format as Data Record Created Trigger.

<br />

## Data Record Deleted Trigger

**Type:** `data-record-deleted-trigger`

This trigger launches a flow when a data record is deleted in a selected Data Source.

```yaml theme={null}
trigger:
  type: data-record-deleted-trigger
  name: Contact Deleted
  config:
    dataSource:
      collectionKey: contacts
    fieldMapping:
      key: contact-mapping
```

**Configuration options:**

* **`dataSource`** – Specifies which [Data Source](/reference/workspace-elements/data-sources) collection to monitor
* **`fieldMapping`** – Optional [Field Mapping](/reference/workspace-elements/field-mappings) to transform data about the deleted record

**Output:**

The output contains information about the deleted record. Note that some external apps may only provide the record ID.

```javascript theme={null}
{
  id: 'contact-123',
  name: 'John Doe'
}
```

<br />

## Connector Event Trigger

**Type:** `connector-event-trigger`

The Connector Event Trigger launches flows in response to connector-specific events.

```yaml theme={null}
trigger:
  type: connector-event-trigger
  name: Custom Webhook Event
  config:
    eventKey: custom-event
    filter:
      $eval:
        $var: $.payload.status
      $eq: completed
```

**Configuration options:**

* **`eventKey`** – Key of the event to trigger on
* **`filter`** – Optional filter to conditionally trigger the flow

**Output:**

The output structure depends on the specific connector and event type. Refer to the connector's documentation for details.
