Trigger Types

Webhook

HTTP endpoints that start workflows when called

Schedule

Time-based triggers using cron expressions

Event

React to system or custom events

Message

Process messages from queues or streams

Configuration

Each trigger type has its own configuration options. Here are examples for each type:

trigger:
  type: webhook
  config:
    url: /workflows/process-data
    method: POST
  schema:
    type: object
    properties:
      data:
        type: object
        description: The data to process
      metadata:
        type: object
        description: Additional context
    required: [data]

Schema Validation

Triggers support JSON Schema validation for input data. This ensures that workflows only process valid data and fail early if the input doesn’t match the expected format.

trigger:
  type: webhook
  config:
    url: /workflows/analyze-content
    method: POST
  schema:
    type: object
    properties:
      content:
        type: string
        minLength: 1
        maxLength: 10000
      options:
        type: object
        properties:
          language:
            type: string
            enum: [en, es, fr]
          sentiment:
            type: boolean
            default: false
    required: [content]
    additionalProperties: false

Advanced Features

Error Handling

Configure how trigger errors should be handled:

trigger:
  type: webhook
  config:
    url: /workflows/process
    method: POST
  on_error:
    retry:
      attempts: 3
      backoff: exponential
      interval: 1s
    fallback:
      workflow: error-handler

Rate Limiting

Control the rate of workflow executions:

trigger:
  type: webhook
  config:
    url: /workflows/analyze
    method: POST
    rate_limit:
      requests: 100
      period: 1m

Conditional Execution

Add conditions to control when triggers should start workflows:

trigger:
  type: event
  config:
    event: document.updated
  condition: "{{ event.changes.status == 'published' }}"

API Reference

type
string
required

Type of trigger (webhook, schedule, event, message)

config
object
required

Trigger-specific configuration

schema
object

JSON Schema for validating trigger input

on_error
object

Error handling configuration

rate_limit
object

Rate limiting configuration

condition
string

Template expression for conditional execution

Best Practices

1

Schema Definition

  • Always define input schemas
  • Validate required fields
  • Set appropriate constraints
  • Document field purposes
2

Error Handling

  • Configure retry policies
  • Implement fallback mechanisms
  • Log trigger failures
  • Monitor trigger health
3

Security

  • Use HTTPS for webhooks
  • Implement authentication
  • Validate request origins
  • Sanitize input data
4

Performance

  • Set appropriate rate limits
  • Configure batch sizes
  • Use efficient schemas
  • Monitor trigger latency

References