Trigger Types and Scopes
Not all combinations are valid:
When the automation fires, it creates an event with
event_data.type set to event_name and any payload fields merged in. That event enters the rules engine like any other event.
Cron Automations
Cron automations fire on a recurring schedule defined by a standard cron expression.
The automation tracks
last_run_at, last_error, and consecutive_failures for observability. Transient failures do not disable the automation; it stays active and fires again on schedule. Only a terminal error, such as a cron expression that can no longer be scheduled, sets status failed.
One-Time Automations
One-time automations fire a single event at a specific timestamp, then transition tocompleted.
Immediate Automations
Immediate automations begin fan-out (creating one event per matching participant) as soon as they are created. They are alwaysparticipants scope. This is what the BROADCAST rule action creates under the hood.
Participant State Automations
Participant state automations fire events when individual participants meet a condition. Each qualifying participant gets its own subscription with an independent trigger schedule. They are alwaysparticipants scope.
Schedule Types
Theschedule_type determines how each participant’s trigger time is computed.
Trigger types use lowercase (
cron, one_time, immediate, participant_state), while schedule types use uppercase (ATTRIBUTE_DATE, INTERVAL, CRON, THRESHOLD).MM-DD format recurs yearly (birthdays, anniversaries). YYYY-MM-DD fires once on the exact date (trial expirations, contract renewals). If the attribute is missing or unparseable, that participant is skipped.
birthday: "03-15" would trigger on March 8th each year.
INTERVAL triggers at a fixed duration relative to each participant’s subscription. The timer is independent per participant: if participant A subscribes on January 1 and participant B subscribes on January 15, a 30-day interval fires January 31 for A and February 14 for B.
CRON is a calendar-aligned schedule shared across participants. Unlike INTERVAL, all subscribed participants fire at the same wall-clock times regardless of when they were subscribed.
THRESHOLD triggers when a participant’s counter crosses a value. The optional
delay gives the participant time to take further action before the event fires.
lifetime_spend counter reaches 1000. If the counter drops below 1000 during the delay, a guard_condition can prevent the event from firing.
Filters and Guards
participant_filter and guard_condition apply to every participants-scoped automation (cron, one-time, immediate, and participant state), not only the participant state trigger described in this section. The two optional CEL expressions run at different phases.
participant_filter runs during evaluation and controls which participants get subscriptions. A birthday automation only makes sense for participants who have a birthday attribute:
false are skipped. If a previously qualifying participant no longer matches on re-evaluation, their subscription is cancelled.
guard_condition runs at trigger time, right before the event fires. Use it when state may have changed between evaluation and trigger:
false, the event is skipped for that participant but the subscription remains active for future evaluation.
Both expressions use the same participant vocabulary as rule conditions: the participant.counter/tag/attribute.<name> shorthand, program.counter/tag/attribute.<name> accessors, the groups list, and participant identity fields (participant.id, participant.external_id, participant.status, participant.enrolled_at, participant.created_at).
Two differences from rule conditions:
nowis the worker’s wall-clock time when the expression runs, not an event timestamp. There is no event here.event.*references and balance references (participant.balance.<symbol>,participant.balances) are rejected with a400when the automation is saved.
warnings array for expression issues that do not block saving, including deprecated_alias when an expression uses the deprecated state variable instead of participant. Execution stats also report participants_skipped_error, the per-run count of participants skipped because the filter or guard expression errored for them.
Subscriptions
Each qualifying participant gets a subscription: the per-participant record of when their event should fire. A birthday automation with three qualifying participants creates three subscriptions, each with a differentnext_trigger_at based on that participant’s birthday attribute.
Scrip periodically re-evaluates the automation to pick up new participants and drop those who no longer match. You can also trigger a re-evaluation manually:
Lifecycle
Every automation has astatus that controls whether it can fire:
Status transitions
Onlyactive and paused are reversible. The other three statuses are terminal. To re-run a completed one-time automation, create a new one.
Execution status (participant-scoped only)
Participant-scoped automations track fan-out progress with a separateexecution_status. This is distinct from status because a recurring automation stays active across multiple fan-out cycles, while execution_status tracks the current cycle:
Manual trigger requires
execution_status to be idle. If a fan-out is already running, wait for it to complete or cancel it first.
Cancel behavior
Canceling a participant-scoped fan-out setsexecution_status to failed. Participants already processed keep their events; remaining participants are skipped. The automation stays active and fires again on its next schedule.
Canceling a program-scoped one-time archives the automation. Since archived is terminal, the automation cannot be triggered afterward.
Rule-Created Automations
TheSCHEDULE_EVENT and BROADCAST rule actions create automations automatically. These appear with source: rule_action and are deduplicated across event replays. See Rule Actions for details.
Managing Automations
List, update, trigger, and delete automations through the API. The list endpoint supports filtering bytrigger_type, scope, status, and source (api or rule_action).