Skip to content

Triggers

An HTTP trigger is a way to invoke an application through HTTP requests. It creates a publicly accessible endpoint that responds to web requests. HTTP triggers are typically used for webhooks, API endpoints, and serverless functions that need to respond to incoming HTTP requests.

Method: The HTTP method (GET, POST, PUT, PATCH, DELETE, or ALL) Path: The URL path where the trigger is accessible (e.g., /api/webhook) Full URL: Combines with the deployment domain (e.g., https://asgdfs55sd4gs.cloud.heim.dev/api/webhook)

HTTP triggers include Cross-Origin Resource Sharing (CORS) configuration to control browser-based access:

  • Allowed Origins: List of domains permitted to access the endpoint (e.g., https://upcloud.com)
  • Allowed Headers: HTTP headers that can be included in requests (e.g., Content-Type, Authorization)

Example http trigger configuration:

[[trigger]]
type = 'http'
path = '/test/api/*'
method = 'GET'

This will create a HTTP trigger that will trigger on the HTTP method GET and on the path /test/api/*. The * means is a wildcard which means it will trigger on any path following the initial path of /test/api/.

Cron Expression (6-digit representation): The schedule is defined using five space-separated fields that determine when the trigger fires:

  • Second (0-59): Which second of the minute
  • Minute (0-59): Which minute of the hour
  • Hour (0-23): Which hour of the day
  • Day (1-31): Which day of the month
  • Month (1-12): Which month of the year
  • Weekday (0-7): Which day of the week (0 and 7 are both Sunday)

Each field can contain:

  • A specific value (e.g., 5 for “at 5”)
  • An asterisk * meaning “every” (e.g., “ in the minute field means “every minute”)
  • Ranges (e.g., 1-5)
  • Lists (e.g., 1,3,5)
  • Step values (e.g., */15 for “every 15 minutes”)

Common Use Cases:

  • Scheduled reports: Generate and send reports daily, weekly, or monthly
  • Data cleanup: Run maintenance tasks at off-peak hours
  • Batch processing: Process accumulated data at regular intervals
  • Automated backups: Schedule regular data backups
  • Periodic checks: Monitor external services or APIs at set times

CRON triggers are ideal for any task that needs to run automatically on a predictable schedule without manual intervention.

Example cron trigger configuration:

[[trigger]]
type = 'cron'
schedule = '0 0/2 * * * *'

Example long-running trigger configuration:

[[trigger]]
type = 'long-running'