Skip to content

Get notified

Hear when a run fails, recovers or ends: on your desktop, in a chat, or any way you like.

You need: a flow. For flows that run by themselves, also the daemon. The daemon sends notifications for registered flows; for a run in your terminal, add --notify.

# in a flow file
notify:
desktop: true # tells you when a run fails (the default)
System What it needs
Linux notify-send (package libnotify-bin or libnotify) and a desktop session
macOS Nothing. It appears in the Notification Center.
Windows Nothing. It appears as a toast.

The webhook address holds a token, so keep it in the secret store, not in the file:

$ truss secret set SLACK_WEBHOOK # paste the https://hooks.slack.com/... address
notify:
on: [failure, recovered]
webhook:
url: secret:SLACK_WEBHOOK # the address from the store
format: slack # slack | discord | teams | generic

generic posts JSON that any service can read.

Send an email or a text message, or write to a file:

notify:
on: failure
run: ./scripts/mail-me.sh

The command runs in the project folder and finds the outcome in TRUSS_NOTIFY_FLOW, TRUSS_NOTIFY_STATUS, TRUSS_NOTIFY_REASON, TRUSS_NOTIFY_RUN_ID, TRUSS_NOTIFY_TRIGGER, TRUSS_NOTIFY_TITLE and TRUSS_NOTIFY_TEXT.

on takes one value or a list. The default is failure.

on You hear about
failure a failed run, or a scheduled time missed while the daemon was stopped
success every successful run
recovered the first success after a failed run
changed a run that ended differently from the one before
always every run that ran, and missed schedules

You can use several ways at once: desktop, webhook and run in one notify block.

$ truss run backup --notify

recovered and changed compare with the run before, which only the daemon keeps.

A notification that cannot be sent never changes the result of the run. The reason is printed by truss run --notify, and written to the daemon log (truss daemon logs) otherwise.

  • Linux, no desktop notification: install libnotify, and run the daemon inside your login session.
  • No Slack message: truss secret list shows whether the secret is stored; the address must start with https://.

Every key is in the notify reference.