Timer
Timer events provider は、cron expression を使った scheduled task execution を可能にします。主な用途:
- 日次レポート
- 定期的なクリーンアップ
- スケジュールされた通知
- 定期的な data sync
{ "events-timer": { "enabled": true, "timezone": "America/New_York" }}設定オプション
Section titled “設定オプション”| Option | Required | Description |
|---|---|---|
enabled | Yes | provider を有効/無効にする |
timezone | No | デフォルトの timezone(デフォルト: UTC) |
スケジュールを定義する
Section titled “スケジュールを定義する”Flow 内
Section titled “Flow 内”name: scheduled_tasksversion: "1.0"
nodes: - id: daily_report type: http config: method: GET url: "https://api.example.com/reports/daily" next: send_report
- id: send_report type: reply config: channel: "slack-reports" message: "Daily report: {{http_response}}"
triggers: - type: timer cron: "0 9 * * *" target: daily_report timezone: "America/New_York"Cron Expression の形式
Section titled “Cron Expression の形式”┌───────────── minute (0-59)│ ┌───────────── hour (0-23)│ │ ┌───────────── day of month (1-31)│ │ │ ┌───────────── month (1-12)│ │ │ │ ┌───────────── day of week (0-6, 0=Sunday)│ │ │ │ │* * * * *よく使うスケジュール
Section titled “よく使うスケジュール”| Schedule | Cron Expression | Description |
|---|---|---|
| Every minute | * * * * * | 毎分実行 |
| Every hour | 0 * * * * | 毎時 0 分に実行 |
| Daily at 9 AM | 0 9 * * * | 毎日 9:00 に実行 |
| Weekly Monday | 0 9 * * 1 | 毎週月曜 9:00 に実行 |
| Monthly 1st | 0 0 1 * * | 毎月 1 日の深夜 0 時に実行 |
Daily Cleanup
Section titled “Daily Cleanup”nodes: - id: cleanup type: http config: method: DELETE url: "https://api.example.com/sessions/expired"
triggers: - type: timer cron: "0 2 * * *" # 2 AM daily target: cleanupWeekly Summary
Section titled “Weekly Summary”nodes: - id: generate_summary type: llm config: model: "gpt-4" prompt: "Generate weekly summary from: {{data}}" next: send_summary
triggers: - type: timer cron: "0 9 * * 1" # Monday 9 AM target: generate_summaryPeriodic Health Check
Section titled “Periodic Health Check”nodes: - id: health_check type: http config: method: GET url: "https://api.example.com/health" next: check_result
- id: check_result type: branch config: conditions: - expression: "http_response.status != 200" next: alert default: done
- id: alert type: reply config: channel: "slack-alerts" message: "Health check failed!"
triggers: - type: timer cron: "*/5 * * * *" # Every 5 minutes target: health_checkTimezone の扱い
Section titled “Timezone の扱い”triggers: - type: timer cron: "0 9 * * *" target: daily_task timezone: "Europe/London" # 9 AM London time