Triggers & Automation
Triggers enable scheduled automation and event-driven workflows for your applications.
What are Triggers?
Triggers are scheduled tasks that:
- Execute on a cron schedule (per-second precision)
- Call registered backend services
- Pass execution context and parameters
- Support enable/disable without deletion
Creating a Trigger
Step 1: Navigate
Open a project, select the tenant and application, then open the application's Triggers page.
Step 2: Click Create
Click the Add Trigger button.
Step 3: Configure
- Name (required) - Descriptive trigger name
- Description - What this trigger does
- Run Key (required) - Identifier for the backend
- Cron Expression (required) - Schedule (see below)
- Enabled - Start enabled or disabled
Step 4: Save
Click Create to save. The trigger belongs to the application whose Triggers page you are on.
Cron Expressions
Triggers use standard cron syntax with second precision:
┌─────── second (0-59)
│ ┌────── minute (0-59)
│ │ ┌───── hour (0-23)
│ │ │ ┌──── day of month (1-31)
│ │ │ │ ┌─── month (1-12)
│ │ │ │ │ ┌── day of week (0-6, 0=Sunday)
│ │ │ │ │ │
* * * * * *Common Examples
| Expression | Description |
|---|---|
0 0 * * * * | Every hour at minute 0 |
0 */5 * * * * | Every 5 minutes |
0 0 0 * * * | Daily at midnight |
0 0 9 * * 1-5 | Weekdays at 9 AM |
0 30 14 * * * | Daily at 2:30 PM |
0 0 0 1 * * | First day of month |
Testing Cron Expressions
Use online tools like crontab.guru for the trailing five fields, or test in a development environment.
Per-Second Precision
Manager cron expressions always have six fields — the first field is seconds. For example, 30 * * * * * runs at 30 seconds past every minute. Invalid expressions are rejected when the trigger is saved.
Trigger List
The application's Triggers page lists each trigger with:
- Name - Trigger display name
- Description - What the trigger does
- Schedule - Cron expression
- Enabled - Active/inactive state
- Actions - Edit, Enable/Disable, Delete
Editing a Trigger
- Click the Edit icon on a trigger
- Modify fields:
- Name
- Cron expression
- Run key
- Description
- Click Save Changes
WARNING
Changing the cron expression takes effect immediately. The new schedule applies to the next execution.
Enable/Disable Triggers
Toggle triggers without deleting them:
From List
Click the toggle switch in the "Enabled" column.
From Edit Form
Check or uncheck the "Enabled" checkbox.
Use cases:
- Temporarily pause automation
- Disable during maintenance
- Test schedule changes
Deleting a Trigger
- Click Delete icon on the trigger
- Confirm deletion
- Trigger is permanently removed
Deleted triggers:
- Stop executing immediately
- Cannot be recovered
How Triggers Work
Backend Registration
For triggers to execute, your application backend must:
- Register with Manager using a machine user
- Provide a callback URL for trigger execution
- Keep connection alive with heartbeat signals
See Backend Registration for technical details.
Trigger Execution Flow
1. Manager checks cron schedules (every trigger_check_interval)
2. Finds triggers due to execute
3. Looks up registered backends for the application
4. POSTs trigger payload to backend callback URL
5. Backend processes the trigger
6. Manager records dispatch metrics and logs failuresTrigger Payload
Backends receive JSON payload:
{
"trigger_id": "uuid",
"trigger_name": "Daily Report",
"cron_expression": "0 0 * * * *",
"run_key": "daily-report",
"executed_at": "2025-12-01T12:00:00Z"
}Common Use Cases
Daily Reports
Name: Daily Sales Report
Cron: 0 0 0 * * *
Run Key: daily-sales-reportBackend generates and emails sales report.
Hourly Data Sync
Name: Sync External Data
Cron: 0 0 * * * *
Run Key: data-syncBackend fetches data from external API.
Cleanup Tasks
Name: Clean Old Logs
Cron: 0 0 2 * * *
Run Key: log-cleanupBackend purges logs older than 30 days.
Monitoring Health Checks
Name: Health Check
Cron: 0 */5 * * * *
Run Key: health-checkBackend checks service health every 5 minutes.
Weekly Maintenance
Name: Weekly Backup
Cron: 0 0 3 * * 0
Run Key: weekly-backupBackend performs weekly backup on Sundays at 3 AM.
Best Practices
Naming
- Use descriptive names: "Daily Report", "Hourly Sync"
- Include frequency: "Every 5min Health Check"
- Avoid generic names: "Trigger 1", "Test"
Scheduling
- Avoid peak hours - Schedule heavy tasks during off-peak
- Stagger triggers - Don't run all triggers at same time
- Consider time zones - Cron uses server timezone
- Test schedules - Verify cron expression before deploying
Run Keys
- Use consistent naming: kebab-case
- Match backend expectations
- Document in backend code
Monitoring
- Check last run times regularly
- Monitor backend logs for errors
- Set up alerts for failed executions
Troubleshooting
Trigger Not Executing
Check:
- Is the trigger enabled?
- Is a backend registered and healthy for the application?
- Is the cron expression valid?
- Check backend logs for errors
Debug:
- View trigger details
- Check the executor metrics and Manager logs
- Verify the backend's heartbeat has not timed out
- Test the cron expression
Trigger Executing Too Often
Reason: Cron expression is too frequent
Solution:
- Review cron expression
- Add delays between executions
- Consider aggregating tasks
Backend Not Receiving Triggers
Check:
- Is backend registered?
- Is callback URL correct and accessible?
- Is machine user authentication valid?
- Check network/firewall rules
Solution: See Backend Registration
Trigger Executing at Wrong Time
Reason: Timezone mismatch
Solution:
- Verify server timezone
- Adjust cron expression for timezone
- Document timezone in trigger description
Monitoring Trigger Execution
Executor Metrics
Trigger execution is monitored through the executor's Prometheus metrics (pfy_executor_*, exposed on the metrics port) and the Manager's server logs:
- Execution counts and durations per application
- Backend dispatch success/error rates
- Dispatch latency
See the Trigger System concepts page for the full metric list.
Backend Health
Backends must re-register (heartbeat) periodically; registrations whose last heartbeat exceeds cron.backend_heartbeat_timeout are marked inactive and stop receiving triggers.
See Also
- Backend Registration - Connect your backend
- Machine Users - Authentication for backends
- Applications - Application management
- Audit Logs - Track execution history