# Workflow Triggers

Automate workflow execution with triggers that respond to external events or run on schedules. Configure webhooks to receive data from external systems or set up recurring schedules for periodic automation.

## What are Workflow Triggers?

Workflow triggers are automated execution mechanisms that start workflows without manual intervention. Instead of clicking "Run" or calling the API directly, triggers enable workflows to execute automatically based on:

* **External events** - Webhooks called by third-party systems
* **Time-based schedules** - Recurring executions (hourly, daily, weekly, monthly)

**Key Benefits**:

* Fully automated workflow execution
* Event-driven architecture integration
* Scheduled batch processing
* Reduced manual intervention
* Scalable automation patterns

## Trigger Types

AgenticFlow supports two types of workflow triggers:

### 1. Webhook Triggers

Execute workflows when external systems send HTTP requests to a unique webhook URL.

**Use cases**:

* Receive data from third-party APIs
* Integrate with SaaS platforms (Salesforce, Stripe, GitHub)
* Process incoming form submissions
* Handle payment notifications
* React to IoT device events
* Custom API integrations

**How it works**:

1. Create a webhook trigger for your workflow
2. Configure authentication and HTTP settings
3. Get a unique webhook URL
4. External systems POST data to the URL
5. Workflow executes with request data as input

[Learn more about Webhook Triggers �](https://docs.agenticflow.ai/workflows/triggers/webhook-triggers)

### 2. Schedule Triggers

Execute workflows automatically on a recurring schedule using cron expressions or fixed intervals.

**Use cases**:

* Daily report generation
* Hourly data synchronization
* Weekly backup operations
* Monthly billing processes
* Periodic health checks
* Batch data processing

**How it works**:

1. Create a schedule trigger for your workflow
2. Configure cron expression or interval
3. Set start/end dates (optional)
4. Workflow executes automatically on schedule
5. View execution history and logs

[Learn more about Schedule Triggers �](https://docs.agenticflow.ai/workflows/triggers/schedule-triggers)

## Comparing Trigger Types

| Feature               | Webhook Triggers              | Schedule Triggers                       |
| --------------------- | ----------------------------- | --------------------------------------- |
| **Execution Pattern** | Event-driven (on demand)      | Time-driven (recurring)                 |
| **Frequency**         | Unlimited (depends on caller) | Based on schedule (hourly, daily, etc.) |
| **Input Data**        | From webhook request body     | From trigger configuration              |
| **Authentication**    | Basic, Bearer, or None        | Not applicable                          |
| **Use Case**          | External integrations         | Periodic automation                     |
| **Best For**          | Real-time event processing    | Batch operations                        |

## Getting Started

### Choose Your Trigger Type

**Use Webhook Triggers when**:

* You need to react to external events in real-time
* Third-party systems need to push data to your workflow
* Integration requires event-driven architecture
* Execution timing depends on external events

**Use Schedule Triggers when**:

* You need periodic, recurring execution
* Workflows should run at specific times
* Batch processing of accumulated data
* Time-based automation (reports, backups, sync)

### Quick Setup

Both trigger types follow a similar setup process:

1. Navigate to your workflow
2. Open the "Triggers" configuration section
3. Click "Create Trigger"
4. Choose trigger type (Webhook or Schedule)
5. Configure trigger settings
6. Save and activate

## Trigger Management

### Common Operations

**Create Trigger** Set up new webhook or schedule triggers for your workflow. Each workflow can have multiple triggers.

**View Triggers** See all active and inactive triggers configured for a workflow with their settings and status.

**Update Trigger** Modify trigger configuration including name, description, settings, and active status.

**Enable/Disable** Toggle triggers on or off without deletion. Inactive triggers don't execute but retain configuration.

**Delete Trigger** Permanently remove triggers. This action cannot be undone.

### Monitoring & History

Both trigger types provide execution tracking:

* **Event History** - View all trigger executions
* **Execution Status** - Success or failure status
* **Workflow Runs** - Link to resulting workflow runs
* **Error Details** - Debug information for failed executions
* **Timestamps** - When triggers fired

## Trigger Limits

Each workspace has limits on active triggers:

* **Maximum Active Schedules**: 10 per workspace
* **Webhook Triggers**: Unlimited (subject to fair use)
* **Execution History**: Last 100 events per trigger

See [Platform Limits](https://docs.agenticflow.ai/workflows/broken-reference) for complete details.

## Security Best Practices

### Webhook Security

* **Always use authentication** for production webhooks (Bearer or Basic)
* **Use HTTPS** for all webhook communications (enforced)
* **Rotate credentials** regularly (every 90 days recommended)
* **Validate input data** in your workflow nodes
* **Monitor webhook events** for suspicious activity

### Schedule Security

* **Validate target parameters** before saving schedules
* **Review execution history** regularly
* **Set end dates** for temporary schedules
* **Disable unused schedules** instead of leaving them active
* **Monitor credit consumption** for scheduled workflows

## Use Cases by Industry

### E-commerce

* **Webhook**: Order notifications, payment confirmations, shipping updates
* **Schedule**: Daily sales reports, inventory sync, abandoned cart reminders

### Finance

* **Webhook**: Transaction notifications, fraud alerts, payment webhooks
* **Schedule**: End-of-day reconciliation, monthly statements, compliance reports

### Marketing

* **Webhook**: Form submissions, campaign events, lead notifications
* **Schedule**: Social media posting, email campaigns, analytics reports

### Operations

* **Webhook**: System alerts, deployment notifications, monitoring events
* **Schedule**: Database backups, log rotation, health checks

## Troubleshooting

### Common Issues

**Trigger not executing**

* Check if trigger is enabled (`is_active: true`)
* Verify workflow is published and active
* Confirm sufficient credits available
* Review trigger configuration

**Webhook authentication failing**

* Verify Authorization header format
* Check credentials match configuration
* Ensure HTTPS is used
* Review webhook event logs

**Schedule not firing**

* Verify cron expression is valid
* Check schedule start/end dates
* Ensure schedule is enabled
* Confirm workspace schedule limit not exceeded

**Execution errors**

* Check workflow input schema matches trigger data
* Review workflow run logs
* Verify all required nodes are configured
* Check integration credentials

See [Troubleshooting Guide](https://docs.agenticflow.ai/support/troubleshooting) for detailed solutions.

## API Reference

Manage triggers programmatically via the REST API:

* **Create Trigger**: `POST /workflows/{workflow_id}/triggers`
* **List Triggers**: `GET /workflows/{workflow_id}/triggers`
* **Get Trigger**: `GET /workflows/triggers/{trigger_id}`
* **Update Trigger**: `PUT /workflows/triggers/{trigger_id}`
* **Delete Trigger**: `DELETE /workflows/triggers/{trigger_id}`
* **Get Events**: `GET /workflows/{workflow_id}/triggers/{trigger_id}/events`

See [API Documentation](https://docs.agenticflow.ai/workflows/broken-reference) for complete reference.

***

## Next Steps

### Detailed Guides

* [**Webhook Triggers**](https://docs.agenticflow.ai/workflows/triggers/webhook-triggers) - Complete guide to webhook configuration
* [**Schedule Triggers**](https://docs.agenticflow.ai/workflows/triggers/schedule-triggers) - Cron and interval scheduling

### Related Documentation

* [Workflow Execution](https://docs.agenticflow.ai/workflows/workflow-single-run) - Running workflows manually
* [Workflow Inputs](https://github.com/PixelML/agenticflow-docs/blob/main/docs/04-workflows/building-blocks/inputs/README.md) - Configuring workflow inputs
* [API Reference](https://docs.agenticflow.ai/workflows/broken-reference) - REST API documentation
* [Agent Triggers](https://docs.agenticflow.ai/ai-agents/trigger) - Triggers for AI agents

***

**Ready to automate your workflows?** Choose a trigger type and configure your first automated workflow execution.
