Automations and Scheduled Workflows

Build always-on automations that run on schedules or react to events automatically.

From workflows to automations

While workflows are triggered manually or by webhooks, automations take things further. They run continuously in the background, responding to events on a schedule or in real time. Automations are the key to building truly hands-off processes that scale with your business.

In this guide, we'll cover everything you need to know about building, deploying, and monitoring automations in Okinawa.

Trigger types

Automations support several trigger types, each suited to different use cases:

  • Scheduled — Run on a cron schedule. Perfect for periodic tasks like data syncing, report generation, and cleanup jobs. Supports standard cron syntax: 0 */6 * * * runs every 6 hours.
  • Event-based — React to events from connected integrations. For example, trigger when a new GitHub pull request is opened, a Slack message mentions your bot, or a Salesforce opportunity changes stage.
  • Webhook — Accept incoming HTTP requests from any external service. Okinawa generates a unique URL for each webhook automation.
  • Hybrid — Combine multiple triggers. An automation can listen for events from several sources simultaneously.

Building your first automation

To create an automation, navigate to Automations → New Automation in the dashboard, or use the CLI:

okinawa automation create --name "Daily Report" --trigger schedule --schedule "0 9 * * *"

This creates a new automation that runs every day at 9 AM. Next, add steps to define what happens when it runs:

okinawa automation add-step "Daily Report" \\\n  --type datadog \\\n  --action query-metrics \\\n  --query "avg:system.cpu{*} by {host}"

Conditional execution

Not every automation needs to run the same steps every time. Use conditions to branch your logic:

  • If/Else blocks — Execute different steps based on data from previous steps
  • Switch blocks — Route to different paths based on a value
  • Try/Catch blocks — Handle errors gracefully with fallback actions

Monitoring and observability

Every automation run is logged with full visibility:

  • Run history — See every execution with timestamps, duration, and status
  • Step-level logs — Drill into each step to see inputs, outputs, and errors
  • Performance metrics — Track execution time, success rate, and error rates over time
  • Alerts — Get notified via Slack, email, or PagerDuty when automations fail or exceed thresholds

Best practices

  • Start simple — Begin with a single trigger and action, then add complexity incrementally
  • Use idempotency keys — Prevent duplicate executions when events are delivered more than once
  • Set timeouts — Prevent automations from running indefinitely by setting a max execution time
  • Test with dry runs — Use the --dry-run flag to test automations without executing real actions
  • Version your automations — Keep a history of changes so you can roll back if needed

Continue Learing