Mast alert sources as code
The app creates an alert source in three taps and hands you its URL. For one phone and a handful of senders that is the whole job. Past that, the set of alert sources is configuration: which ones exist, what each is for, how loud it is by default, which heartbeat watches which cron job. Configuration belongs in a file next to the alert rules that use it, so that a wiped phone, a new laptop or a fresh environment is a re-run rather than an afternoon of tapping.
There are two ways to do that. One is a mast.toml and ribo mast apply: the file holds your alert sources, heartbeats, probes, rotations and escalation policies, and apply makes Mast match it. The other is Terraform, if your team already uses it for the rest of its infrastructure. If you'd rather not install either, the second half of this page does the same job for alert sources and heartbeats with a short Python script against the API.
Which one to use
If you already run Terraform or OpenTofu, use the provider. Mast then sits in the same plan as your servers and DNS, and an alert source's URL can go straight into whatever sends to it.
If you don't, use mast.toml. You don't need to learn Terraform or keep a state file anywhere, and if you have ribo you already have it.
Pick one per account and stick to it. Both of them set the fields you write down, so if both manage the same alert source they'll take turns undoing each other: ribo mast apply sets a field from the file, and the next terraform plan shows a diff and sets it back. To move from mast.toml to Terraform, write the resource blocks, import what already exists by name (shown below), and delete the toml file once terraform plan comes back clean.
mast.toml and ribo
You need ribo 2026.10.0 or later, signed in to the account (ribo login). The alert sources and their URLs work before anybody has linked a phone, but nothing rings until one is linked.
Start from what you have:
ribo mast export > mast.toml[[rotation]]
name = "primary"
handoff = "weekly"
handoff_day = "monday"
handoff_time = "09:00"
tz = "America/Chicago"
order = ["ann@example.com", "bo@example.com"]
[[policy]]
name = "default"
[[policy.step]]
after_secs = 0
target = "user"
user = "ann@example.com"
priority = "page"
[[policy.step]]
after_secs = 600
target = "everyone"
priority = "loud"
[[alert_source]]
name = "deploys"
policy = "default"
quiet_start = "22:00"
quiet_end = "07:00"
quiet_tz = "America/Chicago"
[[heartbeat]]
name = "backup-db1"
period_secs = 86400
grace_secs = 5400The field names are the API's, the ones in the table below. People are emails, and policies and rotations are named, not numbered. A field you leave out is left alone on every run, so a mute or mute hours set on the phone stay set. A field that's in the file wins over the phone.
Edit it, then:
ribo mast applyribo checks the whole file first, then prints what it would do and asks:
unchanged rotation "primary"
unchanged policy "default"
update alert source "deploys"
quiet_start: off → 22:00
quiet_end: off → 07:00
create heartbeat "backup-db1"
kept alert source "scratch" (not in the file)
1 create, 1 update, 2 unchanged, 1 kept
Apply these changes? [y/N]- It matches by name. No state file. A second run with nothing edited prints only
unchangedandkeptlines and writes nothing. - It never deletes unless you ask. Something in Mast the file doesn't mention is listed as kept.
--prunedeletes those instead, and the plan says so before it asks. - It refuses a bad file before writing anything. An unknown key, with its line; a policy or rotation that's in neither the file nor Mast; an email that isn't on the account; a heartbeat setting on a plain alert source.
- The keys stay out of the file. Export never writes an alert source's key or URL, so
mast.tomlcan live in git next to your alert rules. An alert source created byapplygets a new key;ribo mast alert-source show <name>prints its URL. --dry-runprints the plan and stops, and--yesskips the question, which is what a CI job wants.
Writes go in the order rotations, policies, alert sources, heartbeats, probes, so an alert source can name a policy the same file creates, and a probe can name either.
Probes
A probe is a [[probe]] block. It needs a target, and everything else has the default the app would give it: an HTTP GET every five minutes that's up on any 2xx or 3xx.
When you watch a dozen sites the same way, put what they share in [probe_defaults] and let each block be its address:
[probe_defaults]
alert_source = "sites"
policy = "default"
interval_secs = 60
max_ms = 3000
[[probe]]
target = "https://www.example.com"
[[probe]]
target = "https://shop.example.com"
[[probe]]
target = "https://api.example.com/health"
expect_status = 200
body_contains = "ok"
[[probe]]
name = "status page"
target = "https://status.example.com"
interval_secs = 300
[[probe]]
target = "mail.example.com:993"
kind = "tls"A block's own setting wins over the default, so the status page above is checked every five minutes and the rest every minute. [probe_defaults] takes any probe field except name and target. Mast refuses a field the probe's kind doesn't read, so when a file mixes kinds, keep the defaults to what every kind reads (alert_source, policy, interval_secs, max_ms, expect) and put expect_status and the like on the URL probes themselves.
alert_source is the name of the alert source a failure is sent to (channel still works in its place) and policy the name of an escalation policy. Either one can be in the same file or already in Mast. The other fields are the API's, with the same meanings as in the table on the probes page: kind, method, interval_secs, max_ms, expect, expect_status, expect_statuses, expect_header, body_contains, body_not_contains, json_path, expect_value, ignore_case, resolver, send, expect_set, request_headers, request_body, request_content_type, host, domain_expiry and paused.
create probe "https://www.example.com"
create probe "https://shop.example.com"
update probe "status page"
interval_secs: 60 → 300
unchanged probe "mail.example.com:993"- A name is optional. A probe without one is listed by its target, and Mast names it after the target's host.
- A probe is matched by name, then by target. A block with no name is the probe that checks its target, so a second
applychanges nothing. A block that names a probe you made in the app, by its target, takes that probe over and gives it the name. If two probes check the same target, name them, orapplystops and says which target it can't tell apart. - Credentials stay out of the file. A probe that signs in keeps its password or token in Mast, set in the app. Export doesn't write it and
applydoesn't touch it, so a probe that needs one is created from the file and given its credential in the app. - Export writes
[probe_defaults]for you. A setting every probe in the account agrees on goes there once.kind,hostandpausedstay on each probe. --prunedeletes probes too. Without it, a probe the file doesn't mention is kept, like everything else.
Your plan's limits apply to probes made from a file the same as in the app: how many, and how often they run.
ribo 2026.11.1 and earlier don't know [[probe]], and they call the other two blocks [[channel]] and [[vital]]. If ribo mast apply answers unknown field `probe` or unknown field `alert_source` , run ribo upgrade.
Every other ribo mast command, including one-off creates and edits, is on the ribo mast page.
Terraform
Terraform keeps infrastructure in text files. You write down what should exist, terraform plan shows what it would create, change or delete to get there, and terraform apply does it. It keeps a state file of what it made, so the next plan only shows what you've changed since. Terraform doesn't know any particular service itself. Each one comes as a provider, a plugin that turns the blocks in your files into API calls.
OpenTofu is a fork of Terraform, started in 2023 when HashiCorp moved Terraform off its open-source licence. The command is tofu instead of terraform, and it reads the same files and runs the same providers. Everything below works with either.
Mast's provider is tissue-systems/tissue, on the Terraform registry and the OpenTofu registry. It needs an API token from the dashboard's API tokens page with mast:read and mast:write. Put it in TISSUE_TOKEN so it stays out of your files.
This is the same setup as the mast.toml above:
terraform {
required_providers {
tissue = {
source = "tissue-systems/tissue"
version = "~> 0.2"
}
}
}
provider "tissue" {}
data "tissue_mast_person" "ann" {
email = "ann@example.com"
}
data "tissue_mast_person" "bo" {
email = "bo@example.com"
}
resource "tissue_mast_rotation" "primary" {
name = "primary"
handoff = "weekly"
handoff_day = 0 # Monday
handoff_time = "09:00"
tz = "America/Chicago"
order = [data.tissue_mast_person.ann.user_id, data.tissue_mast_person.bo.user_id]
}
resource "tissue_mast_policy" "default" {
name = "default"
steps = [
{ target = "user", user_id = data.tissue_mast_person.ann.user_id, priority = "page" },
{ target = "everyone", priority = "loud", after_secs = 600 },
]
}
resource "tissue_mast_alert_source" "deploys" {
name = "deploys"
policy_id = tissue_mast_policy.default.id
quiet_start = 1320 # 22:00, in minutes past midnight
quiet_end = 420 # 07:00
quiet_tz = "America/Chicago"
}
resource "tissue_mast_heartbeat" "backup_db1" {
name = "backup-db1"
period_secs = 86400
grace_secs = 5400
}export TISSUE_TOKEN=tok_...
terraform init
terraform plan
terraform applyIt behaves the way mast.toml does where it can. An argument you leave out is left to the app, so mute hours or a sound someone sets on their phone stay set. Raising an alert source to page is still done on the owner's phone, and the provider creates alert sources at loud at most.
Where it differs is the URL. An alert source's url is an attribute you can pass to other resources, so it can go straight into a CI secret or an Alertmanager config without anyone copying it out of the app:
resource "github_actions_secret" "mast_deploys" {
repository = "api"
secret_name = "MAST_DEPLOYS_URL"
plaintext_value = tissue_mast_alert_source.deploys.url
}The provider marks it sensitive, so it doesn't show in plan output, but like any sensitive value it's in the state file in plain text. Keep your state where you'd keep a password.
Things you made in the app or with ribo can be brought under Terraform by name:
terraform import tissue_mast_alert_source.deploys deploys
terraform import tissue_mast_rotation.primary primaryOn Terraform 1.5 or OpenTofu 1.6 and later you can write import blocks instead and have terraform plan -generate-config-out=mast.tf write the resource blocks for you. The generated blocks spell out every argument, so trim the ones you'd rather leave to the app.
A probe pages an alert source by its id:
resource "tissue_mast_probe" "www" {
name = "www"
target = "https://www.example.com/health"
interval_secs = 300
expect_status = 200
alert_source_id = tissue_mast_alert_source.deploys.id
}The provider covers alert sources, heartbeats, probes, rotations, overrides and policies. Status pages are coming soon to the provider; until then, set them up in the app. The probe resource and the tissue_mast_alert_source and tissue_mast_heartbeat names came in provider 0.2, so if OpenTofu only finds 0.1, its registry hasn't picked up the newer release yet. tissue_mast_vital and vital_priority are still accepted for a heartbeat, and so is [[vital]] in mast.toml. Files written before alert sources had that name keep working too: tissue_mast_channel, [[channel]], channel = "name", ribo mast channel and the /v1/mast/channels routes are all still accepted. Every argument is listed on the registry.
The rest of this page is about the alert sources themselves, and how to do the same thing without ribo or Terraform.
What the API gives you
- Creation is idempotent by name. Names are unique per owner, and creating a name that already exists answers
409. A catalogue keyed by name needs no state file: what is missing gets created, what exists gets compared. - The URLs are readable back.
GET /v1/mast/statereturns every alert source with its live key and URL, so no file has to remember them. Nothing in the catalogue is secret, and the catalogue can live in git. - An alert source made from a script is an ordinary alert source. The app syncs when it opens, when it returns to the foreground, and every fifteen seconds while it is on screen, so a new alert source is on the phone within a sync. Nothing marks where it came from.
- Rotation is one call with a week of overlap.
POST /v1/mast/alert-sources/{id}/rotateissues a new key, and the previous one keeps accepting sends for seven days. - Account-token calls are recorded. A create, update, rotate or delete made with an account token lands in the account's activity feed. An action from a phone linked to the account is there too, as
phone: <name>. A phone with no account has nowhere to file one.
Without ribo: a reconcile script
If ribo isn't an option, the API is enough for alert sources and heartbeats. This is a trimmed copy of the script that provisions this platform's own paging, and it covers alert sources and heartbeats.
Before the first run
Link a phone. The script works without one, but nothing it makes can ring until a phone is linked. It's a one-time step.
Mint a token with the two Mast scopes. Any member of the account can hold them: owner, admin or developer.
ribo token create mast-provision --scope mast:read --scope mast:writeCheck what the token names before touching anything. A
tok_carries no account name a person would recognise, and alert sources calleddeploysandsecuritywould look entirely plausible in the wrong account while paging the wrong phone.curl -s https://api.tissue.systems/v1/me -H "Authorization: Bearer $TISSUE_TOKEN" | jq '{accountId, scopes}'
The script does the third step itself and refuses to continue on a mismatch.
The catalogue
A JSON file, committed with the alert rules that use it:
{
"alert_sources": [
{"name": "deploys", "default_priority": "normal",
"quiet_start": 1320, "quiet_end": 420, "quiet_tz": "America/Los_Angeles"},
{"name": "security", "default_priority": "page",
"repeat_secs": 120, "dedupe_window_secs": 900}
],
"heartbeats": [
{"name": "backup-db1", "period_secs": 86400, "grace_secs": 5400, "heartbeat_priority": "loud"}
]
}Every field is optional except the name, and a field absent from an entry is left alone on every run. That is deliberate: the phone can mute an alert source or set mute hours, and a reconcile that reset those each time would make the app's own controls useless. A field that is present in the entry wins over the phone.
| Field | Default | Range |
|---|---|---|
name |
required | 1–32 characters of letters, digits, ., _, - and single spaces, starting with a letter or digit. Letters in any script, lowercase where the script has a case; unique per owner. A PATCH with a new name renames it and the URL stays the same, but a script keyed by name will see a new alert source, so rename in one place only |
kind |
channel |
channel or heartbeat; vital is still accepted and means the same. Not changeable |
default_priority |
normal |
quiet, normal, loud or page; a sender can override per message |
max_priority |
loud |
Read-only here. The alert source's highest level: a send asking for more is clamped down to it. Only a registered phone can raise it |
sound |
the tier's own | pager, klaxon, rising, chirp, bleep or default; see Sounds |
quiet_start, quiet_end |
-1 (no window) |
minutes past midnight; a window may wrap midnight |
quiet_tz |
UTC | an IANA zone name such as America/Los_Angeles, or a fixed offset such as -07:00. Prefer the name, it follows daylight saving |
dedupe_window_secs |
300 | 0–86400 |
storm_threshold |
20 | up to 10000 messages per storm_window_secs |
storm_window_secs |
300 | 0–86400 |
repeat_secs |
120 | 0–86400; how often an unacknowledged page repeats |
expire_secs |
3600 | 0–604800; how long an unacknowledged page keeps trying |
escalate_after_secs |
0 (off) | 0–86400; needs a paired partner set in the app |
period_secs |
0 | 0–2592000; a heartbeat needs one, or it could never go down |
grace_secs |
0 | 0–2592000; how late a beat may be before the heartbeat pages |
heartbeat_priority |
loud |
the priority of the page sent when the heartbeat goes down |
An alert source this script creates starts with its highest level at loud, so a page sent to it arrives as a loud. That's deliberate: a token that can create alert sources shouldn't be able to hand itself a pager. It also means an entry carrying "default_priority": "page" pages nobody until the highest level is raised in the app, once, by hand. Raise it on the alert sources that are meant to wake someone; leave the rest at loud.
Escalation is to another person's phone, and pairing two phones is done in the app with a QR code, so the catalogue carries the delay and the app carries the partner.
The reconcile
Standard library only, so it runs wherever Python 3 is. It needs two environment variables: MAST_TOKEN, the tok_… from above, and MAST_ACCOUNT, the account id it must name.
#!/usr/bin/env python3
"""Reconcile mast alert sources and heartbeats against a catalogue.
Prints one JSON document on stdout: the name -> url map plus what changed.
Progress and warnings go to stderr, so the output can be parsed as is.
"""
import json, os, sys, urllib.error, urllib.request
API = "https://api.tissue.systems"
TOKEN = os.environ["MAST_TOKEN"]
ACCOUNT = os.environ["MAST_ACCOUNT"]
FIELDS = ("default_priority", "sound", "quiet_start", "quiet_end", "quiet_tz",
"dedupe_window_secs", "storm_threshold", "storm_window_secs", "repeat_secs",
"expire_secs", "escalate_after_secs", "period_secs", "grace_secs", "heartbeat_priority")
def call(method, path, body=None):
data = json.dumps(body).encode() if body is not None else None
req = urllib.request.Request(API + path, data=data, method=method, headers={
"Authorization": "Bearer " + TOKEN, "Content-Type": "application/json"})
try:
with urllib.request.urlopen(req, timeout=30) as r:
raw = r.read()
return r.status, (json.loads(raw) if raw else {})
except urllib.error.HTTPError as e:
return e.code, json.loads(e.read() or b"{}")
def log(msg):
print(msg, file=sys.stderr)
def die(msg):
log("reconcile: " + msg)
sys.exit(1)
cat = json.load(open(sys.argv[1]))
# Refuse to act until the token names the expected account and both scopes.
status, me = call("GET", "/v1/me")
if status != 200 or me.get("accountId") != ACCOUNT:
die(f"token names account {me.get('accountId')!r}, not {ACCOUNT!r}")
scopes = me.get("scopes", [])
if scopes != "*" and not {"mast:read", "mast:write"} <= set(scopes):
die(f"token is missing mast:read or mast:write (has {scopes})")
status, state = call("GET", "/v1/mast/state")
if status != 200:
die(f"GET /v1/mast/state answered {status}: {state}")
if not [d for d in state["devices"] if not d.get("invalidated_at")]:
log("reconcile: WARNING this owner has no live device. Sends will be accepted "
"and reach nobody. Re-adopt the phone with a device link code.")
live = {c["name"]: c for c in state["channels"] if not c.get("archived_at")}
urls, created, patched, rotated = {}, [], [], []
for section, kind in (("alert_sources", "channel"), ("heartbeats", "heartbeat")):
for entry in cat.get(section, []):
name = entry["name"]
want = {f: entry[f] for f in FIELDS if f in entry}
if kind == "heartbeat" and not want.get("period_secs"):
die(f"heartbeat {name!r} has no period_secs, so it could never go down")
have = live.get(name)
# state carries the live URL. An alert source with no live key cannot receive
# a send at all; rotating it is the same call that recovers from a key
# deleted by hand.
url = have.get("url") if have else None
if have is None:
status, have = call("POST", "/v1/mast/alert-sources", {"name": name, "kind": kind, **want})
if status != 201:
die(f"creating {name}: {status} {have}")
created.append(name)
url = have["url"]
# A response spells a heartbeat's kind "vital".
elif {"vital": "heartbeat"}.get(have["kind"], have["kind"]) != kind:
die(f"{name!r} exists as a {have['kind']}, and the catalogue calls it a {kind}. "
"Rename one of them: kind is not patchable.")
else:
changes = {f: v for f, v in want.items() if have.get(f) != v}
if changes:
status, have = call("PATCH", "/v1/mast/alert-sources/" + have["id"], changes)
if status != 200:
die(f"updating {name}: {status} {have}")
patched.append(name)
if entry.get("rotate") or not url:
status, have = call("POST", f"/v1/mast/alert-sources/{have['id']}/rotate", {})
if status != 200:
die(f"rotating {name}: {status} {have}")
rotated.append(name)
url = have["url"]
urls[name] = url
# In Mast and not in the catalogue. Never deleted: the phone makes alert sources of
# its own, and this script must not be the reason one of them vanished.
wanted = {e["name"] for k in ("alert_sources", "heartbeats") for e in cat.get(k, [])}
extra = sorted(set(live) - wanted)
log(f"reconcile: {len(created)} created, {len(patched)} updated, {len(rotated)} rotated")
for name in extra:
log(f" ? {name} is in Mast and not in the catalogue (left alone)")
json.dump({"urls": urls, "created": created, "patched": patched,
"rotated": rotated, "extra": extra}, sys.stdout, indent=2)
print()MAST_TOKEN=tok_… MAST_ACCOUNT=acct_… python3 mast-reconcile.py mast-alert-sources.jsonThe rules it follows, and why:
- It never deletes. An alert source in Mast that the catalogue does not name is reported and left alone. Deleting is
DELETE /v1/mast/alert-sources/{id}, by hand, once you are sure, and it deletes the alert source's messages with it;PATCHwith{"archived": true}retires an alert source and keeps its messages. If something keeps sending to a deleted alert source's URL, each send gets a 404 and the alert source shows up inretired_keysinGET /v1/mast/state, and under "Deleted alert sources that still get sends" in the web app, until 30 days after the last try. - It refuses a kind mismatch. Kind is not patchable, and archiving the alert source to recreate it would change the URL every sender holds.
- It refuses a heartbeat with no period. A heartbeat that can never go down is a dead-man switch that is quietly dead.
- It rotates on request.
"rotate": trueon an entry issues a new key on the next run; remove the flag afterwards, or the key rotates on every run. - It warns on zero live devices. Sends to an owner whose phone is gone answer
202and reach nobody, and a green run must not suggest otherwise.
Run it twice: the second run reports nothing created, nothing updated, and the same map.
Handing the URLs to senders
A send URL is a bearer credential. Whoever holds it can page the phone, so it stays out of git and out of the catalogue, and each sender gets only the alert sources it sends to. The script prints the map, and with ribo ribo mast alert-source show <name> prints one alert source's URL. Where each URL goes depends on the sender.
A host. An environment file, root-owned and mode 0600, sourced by the cron entries and unit files that send:
# /etc/mast.env
MAST_DEPLOYS=https://mast.tissue.dev/mk_…
MAST_BACKUP_DB1=https://mast.tissue.dev/mk_…A Cell. A vault binding, set before the deploy. A vault value missing at deploy time is stored as a placeholder and the Cell sends to it, so set the value first:
ribo vault set my-cell MAST_DEPLOYS --env MAST_DEPLOYS
ribo deployCI. A repository or environment secret, written from the map by the same job that runs the reconcile.
Daemons read their environment once at start, so a rotated URL reaches a long-running process only after a restart; cron lines and CI jobs pick it up on their next run. Keep the list of things to restart next to the catalogue. The seven-day overlap is what makes a rotation safe to roll out over a day, and it is also the trap: a consumer the rollout missed keeps working for a week and then stops with no error, because the old key is simply gone. A test send from each consumer after a rotation is cheaper than finding out in a week.
From Ansible
Two plays. The first runs on the control node, where the token is, and turns the catalogue into a map; the second renders each host's share of the map onto the host. Fleet hosts never see the token.
- name: Reconcile mast alert sources
hosts: localhost
gather_facts: false
tasks:
- name: Reconcile the catalogue
command: python3 files/mast-reconcile.py files/mast-alert-sources.json
environment:
MAST_TOKEN: "{{ mast_token }}" # vault
MAST_ACCOUNT: "{{ mast_account }}"
register: mast
changed_when: >-
(mast.stdout | from_json).created or
(mast.stdout | from_json).patched or
(mast.stdout | from_json).rotated
no_log: true # stdout holds every URL
- name: Keep the map for the next play
set_fact:
mast_urls: "{{ (mast.stdout | from_json).urls }}"
- name: Render each host's alert source URLs
hosts: fleet
become: true
tasks:
- name: Write /etc/mast.env
copy:
dest: /etc/mast.env
owner: root
mode: "0600"
content: |
{% for name in mast_alert_sources_for_host %}
MAST_{{ name | upper | replace('-', '_') }}={{ hostvars['localhost'].mast_urls[name] }}
{% endfor %}
notify: restart mast consumers
handlers:
- name: restart mast consumers
service:
name: "{{ item }}"
state: restarted
loop: "{{ mast_consumers_for_host | default([]) }}"mast_alert_sources_for_host is a per-host or per-group list of catalogue names; mast_consumers_for_host names the units that snapshot their environment. no_log on the reconcile task is what keeps the URLs and the token out of the play log, at the cost of the script's own progress lines; drop it while debugging, against a throwaway alert source.
A CI job runs the same script the same way, with the token in a secret and the map written to the pipeline's secret store.
Heartbeats: beat on evidence
The catalogue holds a heartbeat's schedule; the beat comes from the job. The rule that keeps a heartbeat honest is to beat only after the job's own success, never from a timer that runs whether or not the job worked:
@daily backup.sh && curl -fsS -m 10 --retry 3 "$MAST_BACKUP_DB1" >/dev/nullWhen the beat has to come from somewhere other than the job, make it conditional on the job's own evidence, such as the age of the file it writes on success:
*/15 * * * * find /var/lib/backup/last-ok -mmin -90 | grep -q . && curl -fsS -m 10 --retry 3 "$MAST_BACKUP_DB1" >/dev/nullWithout that condition the heartbeat proves that cron runs, which is not what you wanted to know.
One heartbeat per thing that fails on its own. Three hosts each running the backup are three heartbeats, not one shared one, because a shared heartbeat stays alive while any of them beats. A heartbeat's clock starts with its first beat. Until then it waits and pages nobody, and if a period and the grace go by without one you get a single quiet card saying it has never beaten. Create the heartbeat and its beat in the same change, so it doesn't sit there waiting.
Closing a page from the monitor that opened it
A monitor that alerts usually also knows when the alert is over. Sending that recovery as an ordinary message leaves the original page on the phone, repeating, beside a green card saying the outage ended. resolve=1 closes it instead. The same key on both sends is what ties them together:
# Alertmanager webhook receiver, or any script shaped like one
firing() {
curl -fsS -X POST "$MAST_ALERTS" \
-d priority=page -d "key=$FINGERPRINT" \
--data-urlencode "title=$ALERTNAME" --data-urlencode "body=$SUMMARY" >/dev/null
}
resolved() {
curl -fsS -X POST "$MAST_ALERTS" \
-d resolve=1 -d "key=$FINGERPRINT" \
--data-urlencode "title=RESOLVED $ALERTNAME" --data-urlencode "body=$SUMMARY" >/dev/null
}--data-urlencode and not -d for the two fields holding somebody else's text: curl joins every -d with & and sends it exactly as given, so a summary containing & or = splits into fields of its own, and a summary containing no = at all turns the whole body back into a plain message, losing the priority and the key the recovery needs to match. --data-urlencode escapes the value first, so the field is always a field. The one-liner form, curl -d "disk full" <url>, stays correct precisely because it is the only thing in the body.
The recovery's own words replace the outage text on the card, the repeat is cancelled, and the 202 says how long the incident ran: {"ok":true,"id":"mm_…","state":"resolved","open_for":842}.
Use the alert's own identity as the key: Alertmanager's fingerprint, a target name, a job id, anything stable across the firing and the recovery and distinct between incidents. The dedupe window does not bound this: key alone merges a repeat only for the alert source's dedupe_window_secs, and a page outlives that window every time somebody is asleep.
A recovery that finds nothing open is stored as a quiet message rather than refused, so a script may send it unconditionally. That also means a wrong key fails silently in the worst direction (the page keeps repeating), so confirm the pair once with a test alert source before trusting it in a rotation.
Full field reference: Incidents.
When the phone is reinstalled
A wiped or reinstalled phone registers as a new Mast owner with no alert sources, while the account stays attached to the owner it was connected to. Do not connect the fresh install to the account, which answers 409, and do not recreate the alert sources. Mint a device link code with the token instead:
curl -X POST https://api.tissue.systems/v1/mast/link-codes \
-H "Authorization: Bearer $TISSUE_TOKEN" -H "Content-Type: application/json" \
-d '{"purpose": "device"}'{"code": "…", "purpose": "device", "expires_at": "2026-09-02T18:40:00Z"}The code is good for five minutes. Open mast://link/<code> on the phone; a QR code of that URL on a laptop screen works. The phone joins the established owner and the throwaway one is retired. Every alert source, key and URL survives, so nothing is re-rendered and nothing restarts. A reconcile run afterwards reports no changes and no device warning.
Where the token stops
- Linking a phone is done from the phone, by signing in or typing a code. So is raising an alert source to
page. - The alert source routes are the interface, and
ribo mastis a client of them like any script. So is the MCP server, which has tools for probes, alert sources, a test page and incidents. GET /v1/mast/alert-sourceslists alert sources and heartbeats together, andGET /v1/mast/heartbeatsthe heartbeats alone.GET /v1/mast/statehas the same list with devices, pairings and recent messages alongside.