Notify
notify tells you how a run ended. At least one of desktop, webhook or run is required.
notify: on: [failure, recovered] # when; default: failure desktop: true # a notification of your system webhook: # Slack, Discord, Teams or any URL url: secret:SLACK_WEBHOOK format: slack run: ./scripts/tell-me.sh # any command| Key | Required | Default | Meaning |
|---|---|---|---|
on |
no | failure |
When to notify. One value or a list. |
desktop |
one of the three | false |
true shows a notification of your system. |
webhook |
one of the three | A web address that receives the message. | |
run |
one of the three | A command for your shell. |
on: when
Section titled “on: when”| Value | You hear when |
|---|---|
failure |
a run failed, or a scheduled time was missed while the daemon was not running |
success |
a run succeeded |
always |
a run ended (not a skipped one, except a missed schedule) |
recovered |
a run succeeded after the flow’s previous run failed |
changed |
a run ended differently from the previous one |
desktop
Section titled “desktop”Uses your system’s own tool: notify-send on Linux (from libnotify), the Notification Center on
macOS, a toast on Windows. A daemon that starts at login can show them; a daemon started over SSH
may not.
webhook
Section titled “webhook”Either a plain address, or a mapping:
webhook: https://example.com/hook # generic JSONwebhook: url: secret:SLACK_WEBHOOK # required format: slack # optional; default generic| Key | Required | Default | Meaning |
|---|---|---|---|
url |
yes | An https:// address, or secret:NAME to read it from the secret store. Plain http:// is allowed only to this machine. |
|
format |
no | generic |
slack, discord, teams or generic. |
- Slack and Discord addresses contain a token: keep them in the store (
truss secret set NAME). - TRUSS posts once and tries again once on a server error. It never follows a redirect.
genericsends{flow, run_id, status, reason, trigger, previous_status, missed, finished_at}as JSON. The reason can name folders on your machine.
run: a command
Section titled “run: a command”notify: run: ./scripts/tell-me.shThe command runs in the project folder and finds the outcome in these variables:
| Variable | Value |
|---|---|
TRUSS_NOTIFY_FLOW |
the flow’s name |
TRUSS_NOTIFY_RUN_ID |
the run’s id |
TRUSS_NOTIFY_STATUS |
how the run ended |
TRUSS_NOTIFY_REASON |
why, in a few words |
TRUSS_NOTIFY_TRIGGER |
what started the run |
TRUSS_NOTIFY_TITLE, TRUSS_NOTIFY_TEXT |
a ready-made title and message |
Where it is sent from
Section titled “Where it is sent from”- The daemon notifies for registered flows, also when the file stopped loading (it then uses the
last valid
notify). truss run --notifynotifies for a run in your terminal. A run tracked with--trackis notified only by--notify.- A notification that cannot be sent never changes the result of the run. The reason goes to the
daemon log, or
truss runprints it. Each channel gives up after 15 seconds, and aruncommand is ended together with everything it started.