Skip to main content
View as Markdown

Record & Comment Triggers

The two triggers that fire from activity inside your app: a row changing, and someone talking about a row.

Record Trigger

Fires when records change in a watched table.

app.yaml
trigger:
  type: record
  table: orders
  events: [create, update]
  watchFields: [status]
  condition:
    conditions:
      - field: '{{trigger.data.record.status}}'
        operator: equals
        value: paid
Property Description
table Name of the table to watch. Required, non-empty.
events Array of create / update / delete. Required, at least one entry.
watchFields On update, only fire when one of these fields changes. At least one entry when present.
condition A condition group — only fire when the row matches the predicate.

watchFields and condition answer different questions. watchFields asks what changed; condition asks what the row now looks like. The example above fires only when status was touched and the resulting status is paid — an order edited from pending to paid fires, an order whose shipping address is corrected does not.

Record context

The row is at {{trigger.data.record.*}} (also reachable as {{trigger.record.*}}). It is not flattened, so {{trigger.data.status}} does not resolve. Two further paths are available:

Path Available on Contains
{{trigger.data.record.*}} all events The row after the change.
{{trigger.data.previousRecord.*}} update only The row before the change.
{{trigger.data.records}} batch writes The full set of affected rows.

previousRecord is what makes "notify when the status left draft" expressible without storing state between runs.

Comment Trigger

Fires when a comment is created on a record in a comments-enabled table.

app.yaml
trigger:
  type: comment
  table: tickets
  when: created
  filter: { mentionsOnly: true }
Property Description
table Name of the table with comments enabled. Required, non-empty.
when approved (moderated-approved only), created (any new comment), or any. Defaults to created.
filter { topLevelOnly, repliesOnly, mentionsOnly }topLevelOnly and repliesOnly are mutually exclusive.
respectReadPermissions Only fire when the comment author can read the record. Defaults to true.

Pick when by what the automation does. approved is right for anything user-visible, since a moderated comment should not page a channel before a human clears it. created is right for internal notifications that want the comment the moment it lands.

Comment context

A comment trigger hands the automation the comment, the record it hangs from, and two ready-made audiences — enough to notify a thread without a single lookup.

Path Type Contains
$trigger.comment.id UUID The comment row.
$trigger.comment.body string The comment body (rich text).
$trigger.comment.author.{id,email,name} string Who wrote it.
$trigger.comment.parentCommentId UUID | null null on a top-level comment; the parent's id on a reply.
$trigger.record.* object The record the comment was posted on.
$trigger.threadParticipants UUID[] Everyone who has written on the thread, excluding the new author.
$trigger.mentions UUID[] The users named in the comment's @ markup.
$trigger.mentionedEmails string[] Those same users' email addresses, excluding the comment's own author.
app.yaml
- name: notifyMentioned
  type: email
  operator: send
  props:
    to: '{{trigger.mentionedEmails}}'
    subject: 'You were mentioned on {{trigger.record.title}}'
    body: '{{trigger.comment.author.name}} wrote: {{trigger.comment.body}}'

mentionedEmails drops the comment's own author even when they mention themselves, so nobody is emailed about their own comment. Repeat mentions of the same person collapse to one address, and a mention whose user no longer exists is skipped rather than failing the run — a half-delivered notification beats a comment endpoint that swallows its automation. Pair it with filter: { mentionsOnly: true } so the automation only runs when there is someone to notify.

Last updated September 1, 2026

This documentation was written with AI, so errors or outdated content are possible. Sovrium is in beta. Contributions and corrections are welcome.

Built with Sovrium