How-to guide

Start workflows with triggers

Run workflows on a schedule, from inbound email, a webhook, an HTTP call or a message queue.

Flow Current 2 min read Updated

Prerequisites

  • A saved workflow

A trigger starts a workflow without anyone pressing Run. All five kinds execute for real in the platform.

Type Starts a run when
trigger_schedule A cron-style schedule fires
trigger_email A matching email arrives (a hosted polling service reads the mailbox)
trigger_webhook An external system calls the webhook URL
trigger_http_request A synchronous HTTP call is made to the trigger
trigger_queue A message arrives on a queue (a hosted polling service reads it)

Create a trigger#

bash
kiwi flow trigger-create --name nightly-report --type trigger_schedule \
  --workflow-id <workflow-id> --config-json '{"cron":"0 */5 * * * *"}'

--config-json holds the settings for the trigger type; the example schedules the workflow every five minutes (the cron expression has a leading seconds field).

Triggers are managed in Studio, or from the CLI:

bash
kiwi flow triggers
kiwi flow trigger-disable --id <trigger-id>
kiwi flow trigger-enable  --id <trigger-id>
kiwi flow trigger-delete  --id <trigger-id>

Passing data into the run#

Whatever starts the run supplies the workflow's declared inputs. Declare the inputs the trigger will provide and mark the ones that must be present as required. See Build a workflow.

Starting a run from your own code#

Any service can start and monitor workflows through the API using the official client SDKs (Python, .NET, Java, Node.js). See Client SDKs.

Expected result

  • The workflow starts automatically when the trigger fires