Skip to main content

Triggers

A trigger is what starts a workflow. When an execution is requested, the engine fires the trigger against the incoming payload; the trigger returns either "proceed" (optionally with an output) or "ignore" (no execution is created).

Four triggers are built in. Reference them by class constant (ManualTrigger::type()) in code.

TriggerType stringStarts a workflow when…
Manual@wf::trigger.manualYour code calls Workflow::run() / dispatch(), or workflow:run.
Webhook@wf::trigger.webhookA POST arrives at the workflow's generated URL.
Schedule@wf::trigger.scheduleA cron expression matches.
Model event@wf::trigger.modelAn Eloquent model fires a lifecycle event.

In every case the payload becomes {{ trigger.* }} in the node graph.


Manual

The default. No wiring — you start it explicitly.

Workflow::run('send-welcome-email', ['email' => 'ada@example.com']);

Config

FieldTypeNotes
payloadbuilderThe shape of the payload this workflow expects. The interactive builder lets you design it; workflow:run then prompts for real values against that shape. Optional.

Webhook

Registers a POST route per workflow at boot, under the webhooks/ prefix, at an unguessable generated path. The request body becomes the trigger payload.

The response is JSON: { "execution_id": "...", "status": "..." }.

Config

FieldTypeNotes
pathtext (read-only)Auto-generated, unguessable. Set for you on save.
secrettext (sensitive)Optional shared secret. When set, the caller must send it in the X-Webhook-Secret header or the request is rejected with 401. Stored encrypted.

Setup notes

  • The route middleware group is webhook_middleware in config (default ['api']).
  • A newly saved webhook workflow only registers its route on the next app boot — restart your app and workers.
  • Runs the workflow synchronously by default (the HTTP request waits for it).

Schedule

Registers an entry on Laravel's scheduler at boot. Requires Laravel's scheduler to be running (schedule:work or a system cron calling schedule:run).

Payload on each fire: { "scheduled_at": "<ISO 8601>", "cron": "<expression>" }.

Config

FieldTypeNotes
crontextRequired. A standard 5-field cron expression, e.g. */5 * * * *.
timezonetextOptional. Defaults to config('app.timezone').

Runs synchronously in the scheduler process. Restart after saving.


Model event

Listens for Eloquent lifecycle events on a model class and starts the workflow when one fires. The payload is the model's attributes plus an event key ({{ trigger.event }}, {{ trigger.id }}, …).

Config

FieldTypeNotes
modeltextRequired. Fully-qualified Eloquent model class.
eventscheckboxWhich events to listen for: created, updated, deleted, restored, forceDeleted.
call_modeselectasync (default) queues the workflow so the model save isn't held up; sync runs it inline in the same process as the event.

Listeners are attached at boot — restart your app and workers after saving, and note that sync mode runs your whole workflow inside the database transaction / request that saved the model.