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

# Triggers

> Automate Project execution with webhooks, schedules, and events

## What are Triggers?

Triggers automatically execute your Projects in response to events, without manual intervention. Instead of clicking "Execute" every time, set up Triggers to run your Projects when specific conditions are met.

## Types of Triggers

### Webhook Triggers

Execute when an HTTP request hits your webhook endpoint.

**Use cases:**

* Payment notifications (Stripe, PayPal)
* GitHub events (push, PR, issue)
* Form submissions
* Third-party service events

**Setup:**

1. Go to Project → Triggers
2. Click **Add Trigger → Webhook**
3. Configure:
   * Path: `/webhook/payment-received`
   * Authentication: API key or HMAC signature
   * Payload transformation (if needed)
4. Save → Get webhook URL
5. Register URL with external service

**Example URL:**

```
https://api.triform.ai/v1/webhooks/your-org/payment-received
```

**Incoming webhook:**

```json
POST /v1/webhooks/your-org/payment-received
{
  "event": "payment.success",
  "amount": 99.99,
  "customer_id": "cust_123"
}
```

**Your Project receives:**

```json
{
  "event_type": "payment.success",
  "amount": 99.99,
  "customer_id": "cust_123",
  "received_at": "2025-10-01T10:30:00Z"
}
```

### Schedule Triggers

Execute at specific times or intervals.

**Use cases:**

* Daily reports
* Periodic data sync
* Cleanup jobs
* Monitoring checks

**Setup:**

1. Go to Project → Triggers
2. Click **Add Trigger → Schedule**
3. Configure schedule:
   * **Cron expression:** `0 6 * * *` (daily at 6 AM)
   * **Interval:** Every 15 minutes
   * **One-time:** Specific date/time
4. Set timezone
5. Define payload (static or dynamic)
6. Save

**Schedule types:**

| Type     | Example                   | Description              |
| -------- | ------------------------- | ------------------------ |
| Cron     | `0 6 * * *`               | Daily at 6 AM UTC        |
| Interval | `Every 15 minutes`        | Repeating interval       |
| Hourly   | `Every hour at :00`       | Top of each hour         |
| Daily    | `Daily at 9:00 AM`        | Specific time daily      |
| Weekly   | `Every Monday at 8:00 AM` | Specific day/time weekly |
| Monthly  | `1st of month at 00:00`   | Specific day each month  |
| One-time | `2025-10-15 14:00:00`     | Single execution         |

**Cron expression format:**

```
* * * * *
│ │ │ │ │
│ │ │ │ └─── Day of week (0-7, 0=Sunday)
│ │ │ └───── Month (1-12)
│ │ └─────── Day of month (1-31)
│ └───────── Hour (0-23)
└─────────── Minute (0-59)
```

**Common patterns:**

* `0 * * * *` — Every hour
* `*/15 * * * *` — Every 15 minutes
* `0 9 * * 1-5` — Weekdays at 9 AM
* `0 0 1 * *` — First of each month

### Manual Triggers

Execute via Execution button.

**Use cases:**

* On-demand processing
* Admin actions
* Testing
* User-initiated workflows

### Viewing Triggers

1. Go to Project → Executions
2. See list of all triggers:
   * Type (webhook, schedule)

### Editing Triggers

1. Select trigger from list
2. Click **Edit**
3. Modify configuration
4. **Save** → Changes take effect immediately

**Note:** Schedule changes apply to future executions, not currently running ones.

### Deleting Triggers

Permanently remove a trigger:

1. Select trigger
2. Click **Delete**
3. Confirm
4. Trigger is removed

**Warning:** Cannot be undone. Webhook URLs will stop working.

## Trigger configuration

### Payload

Define what data the triggered execution receives.

**Static payload:**

```json
{
  "source": "scheduled_job",
  "timestamp": "{{now}}"
}
```

**Dynamic payload from webhook:**

```json
{
  "event_type": "{{webhook.event}}",
  "data": "{{webhook.body}}",
  "headers": "{{webhook.headers}}"
}
```

**Using variables:**

```json
{
  "api_key": "{{global.API_KEY}}",
  "environment": "{{global.ENV}}"
}
```

### Timeout

Set maximum execution time:

* Default: 60 seconds
* Max: 15 minutes (Pro), 60 minutes (Enterprise)

**If timeout reached:**

* Execution is canceled
* Error logged
* Retry policy applies (if configured)

## Webhook authentication

Secure your webhook endpoints.

### API Key

Require API key in header:

```bash
curl -X POST https://api.triform.ai/v1/webhooks/your-endpoint \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"data": "value"}'
```

**Configuration:**

1. Enable API key authentication
2. Provide key to webhook sender
3. Triform validates before execution

## Common patterns

### Pattern 1: Webhook → Process → Notify

```
Webhook receives event
  → Validate and transform
  → Process data
  → Send notification
```

**Example:** Payment received → Update database → Email customer

### Pattern 2: Schedule → Fetch → Process → Store

```
Daily at 6 AM
  → Fetch data from APIs
  → Process and analyze
  → Store results
```

**Example:** Daily report generation

### Pattern 3: Event chain

```
Project A completes
  → Triggers Project B
  → Triggers Project C
```

**Example:** Onboarding flow: Create account → Send welcome → Provision services

### Pattern 4: Error handling

```
Project fails
  → Event trigger fires
  → Error logger Project executes
  → Alert sent to team
```

**Example:** Automated incident response

## Troubleshooting

**Problem:** Webhook not triggering\
**Solution:** Check URL is correct, authentication is valid, check logs for rejected requests

**Problem:** Schedule not running\
**Solution:** Verify cron expression, check timezone, ensure trigger is not paused

**Problem:** Trigger fires but execution fails\
**Solution:** Check payload format, verify required fields, review execution logs

## Next steps

Continue exploring the documentation to learn about Executions and webhook configuration.
