Reference

Triggers

On this page

Triggers are reactions to events on an activity. Each trigger has an event (when it fires), optional conditions (whether it fires), and one or more actions (what it does).

Skeleton

triggers:
  - onCreate:
      - alert: ${__channel} ${initiator}
  - onComment:
      - agent: triage
      - script: extract-jira-ids
  - onEdit:
      - attribute: severity
        ifMatch: critical
        alert: "#oncall"
  - onConclude:
      - email:
          to: ${initiator}
          subject: "Resolved: ${title}"
          body: ${conclusion}

triggers: is a list of trigger groups, each containing one or more trigger lists keyed by event. (Most apps only need one group.)

Events

EventWhen it fires
onCreateA new activity is created
onCommentA comment or a file is posted
onEditAn attribute, or the severity, changes
onConcludeThe activity is closed

onCreate and onConclude fire once per activity. onComment and onEdit fire repeatedly. Triggers also fire from clicked buttons, but those are attached to the attribute, not to an event list — see Attributes.

Conditions

YAML keyPurpose
attributeRestrict an onEdit trigger to changes on this attribute (without it, the trigger fires on every change)
ifMatchRegular expression that the attribute (or comment) value must match
ifNotMatchRegular expression that must not match
- attribute: status
  ifMatch: "^(open|in_progress)$"
  alert: "#team"

For an onComment trigger, ifMatch is checked against the comment text:

onComment:
  - ifMatch: "^(?i)help\\s*$"
    agent: helper

Actions

A trigger can carry one or more of these actions, all inlined into the same trigger:

YAML keyAction
ownerSet the activity owner (role expression)
membersAdd channels/users as activity members
alertPost an alert (channel reference)
conclude: trueClose the activity
setAttribute: {name, value}Set an attribute to a (macro-aware) value
message: {to, body}Post a chat message
email: {to, subject, body, ...}Send an email
script: <name>Run a Starlark script by name (must exist in top-level scripts:)
agent: <name>Engage an AI agent by name
- alert: "#oncall"
  owner: ${initiator}
  setAttribute:
    name: priority
    value: high
  message:
    to: "#announcements"
    body: "${title} acknowledged by ${owner}"

setAttribute

setAttribute:
  name: status
  value: in_progress      # supports macros

message (chat)

message:
  to: "#channel" | "${owner}" | "<user-key>"
  body: "Heads up: ${title}"

email

email:
  to: "${initiator}"
  cc: "ops@example.com"
  bcc: ""
  from: ""              # optional override
  replyTo: ""           # optional
  subject: "Resolved: ${title}"
  body: ${conclusion}
  log: true             # optional, log the email send
  logBody: true         # optional, log the body too

script

script: route-by-category

route-by-category must match a name: under top-level scripts:. See Scripting (Starlark).

agent

agent: triage

triage must match a name: under top-level agents:, or an org-level agent. It answers in the mode it has in the app’s channel, which the app does not set. See Agents in YAML.

Per-attribute triggers

Attributes can carry a single trigger: that fires when that attribute changes. Equivalent to an onEdit trigger with attribute: matching, but co-located with the attribute definition.

- name: status
  type: select
  trigger:
    setAttribute:
      name: conclusion
      value: "Status: ${status.label}"

Each Option can also carry a trigger that fires when that option is selected:

- name: status
  type: select
  options:
    - name: resolved
      label: Resolved
      state: closed
      trigger:
        conclude: true

Loop protection

Scripts and agents only fire on user-originated events. A trigger that runs a script and the script posts a comment will not re-trigger itself — the post carries a marker that blocks onComment from dispatching scripts/agents on that comment.

Declarative cascades (setAttribute, message, email, alert) still chain, up to 8 levels deep. After that, the cascade stops.

Implication: if you want a script that re-fires on itself (e.g. a periodic animation), use conclude.schedule() — see Scripting (Starlark).

Trigger dispatch order

When an event fires triggers:

  1. Script triggers dispatch sequentially via the notification queue.
  2. Agent triggers dispatch concurrently (each runs on its own).
  3. conclude and setAttribute actions are collected from all triggers, then applied to the activity as a single change.
  4. message / email actions fire asynchronously.
  5. alert channels are added to the notification’s alert list.

Steps 1 and 2 skip events that a trigger caused.

Multiple triggers on the same event run in YAML order.

Trigger resolution by event

EventTriggers selected
Activity createdonCreate triggers + any attribute trigger on attributes set during creation
Comment or file postedonComment triggers
Attribute or severity changedonEdit triggers that match the changed attribute(s), and those without an attribute; plus any attribute-level or option-level trigger on that attribute
Activity closedonConclude triggers
Button clickedTrigger attached to the clicked attribute