Docs
Ping the URL when the job finishes.
Quickstart: report a finish
Create a monitor, then call its ping URL when the job finishes. Replace TOKEN with the token on the monitor page. A number on the path is an exit code. /0 is success and /1 is failure. Codes above 255, including /999, are rejected. The path also accepts /ok and /fail. /ok is success and /fail is failure. The curl and Python examples send the exit code. The Node and GitHub Actions examples send /ok or /fail. These examples report the finish only. That covers a missed run and a failure status. It does not time a run that never finishes, and it does not check cost or output.
curl
# After the job, report success or failure using the exit code: curl -fsS -m 10 --retry 3 https://stallbell.com/p/TOKEN/$?
Python
import sys, urllib.request
code = sys.argv[1] if len(sys.argv) > 1 else "0"
urllib.request.urlopen("https://stallbell.com/p/TOKEN/" + code, timeout=10).read()Pass the exit code as the first argument. With no argument, Python reports 0.
Node
const status = process.exitCode ? "fail" : "ok";
await fetch("https://stallbell.com/p/TOKEN/" + status, { method: "POST" });GitHub Actions
- name: Tell Stallbell
if: always()
run: |
STATUS="${{ job.status == 'success' && 'ok' || 'fail' }}"
curl -fsS -m 10 --retry 3 -X POST "https://stallbell.com/p/TOKEN/$STATUS" \
-H 'content-type: application/json' \
-d '{"msg":"${{ github.workflow }}"}'Start, progress, and finish
/start opens a run. /progress keeps a long run from looking stuck. Use the same run_id on start, progress, and the finish so they stay one run. Stuck-after timing is the Stuck after setting. A progress ping later than the start moves that timer forward. A finish ping by itself does not open this timer.
const runId = process.env.RUN_ID ?? crypto.randomUUID();
await fetch("https://stallbell.com/p/TOKEN/start", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ run_id: runId }),
});
await fetch("https://stallbell.com/p/TOKEN/progress", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ run_id: runId }),
});
await fetch("https://stallbell.com/p/TOKEN/" + (process.exitCode ?? 0), {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
run_id: runId,
cost_usd: 0.04,
model: "example",
output: "Wrote 12 rows",
}),
});Cost, output, and run IDs
Send a JSON body to attach a run id, a cost, and the output Stallbell should judge. Use the same run_id on start, progress, and the finish so they stay one run. cost_usd feeds the cost rules. output feeds the empty-output rule, and Stallbell keeps the first 2 KB. exit_code is optional when the path already is the code. Stallbell does not read a provider bill. It only sees cost_usd when the job sends it, and it does not judge whether an answer is any good.
curl -fsS -m 10 --retry 3 -X POST https://stallbell.com/p/TOKEN/0 \
-H 'content-type: application/json' \
-d '{"run_id":"run_123","cost_usd":0.04,"model":"example","output":"Wrote 12 rows"}'import json, urllib.request
body = json.dumps({
"run_id": "run_123",
"cost_usd": 0.04,
"model": "example",
"output": "Wrote 12 rows",
}).encode()
req = urllib.request.Request(
"https://stallbell.com/p/TOKEN/0",
data=body,
headers={"content-type": "application/json"},
method="POST",
)
urllib.request.urlopen(req, timeout=10).read()The six rules
- Missed run: after the first check-in, nothing arrives by the next period or cron time, plus the grace period.
- Failed run: a finished run failed. By default the first failure alerts. Raise Failures in a row to alert only on a streak. A later success closes it.
- Stuck run: a start with no finish or progress within the Stuck after time.
- Loop: more runs in the window than the threshold. It stays open until the rate is back under the threshold and then stays quiet for 10 minutes, so a short pause in a burst does not look like a recovery.
- Cost spike or cost cap: a finished run sends cost_usd above the Cost spike multiple of its usual cost or at its per-run cap, or the day's runs reach the per-day cap.
- Empty output: the finish sent output that is blank, missing a phrase, or not JSON.
n8n
Import n8n-stallbell.json and set the HTTP node URL to your ping URL. Import n8n-stallbell-error.json as the error workflow so a crashed run still checks in as a failure.
Signed webhooks
Outbound alerts use Stallbell-Signature: t=unix,v1=hex. The hex is HMAC-SHA256 of t.body with the channel secret shown in the dashboard. Stallbell does not follow redirects. The body is JSON. Values are the raw strings from the ping, not Slack markup.
Every payload has these fields:
- type: why this delivery was sent.
- id: the notification id.
- sent_at: when Stallbell sent it, as an ISO timestamp.
- incident: the incident, or null.
- monitor: id, name, slug, project, and url, or null.
- summary: a short note, or null.
incident, when present, has id, rule, severity, status, title, opened_at, resolved_at, and details.
type is one of:
- incident.opened: a rule opened an incident.
- incident.resolved: the incident closed. status is resolved.
- incident.reminder: the incident is still open.
- alert.summary: several alerts fired in a short time, so Stallbell sent one note instead of another incident. incident and monitor are null. summary is the note, for example "+3 more alerts in the last 5 minutes." This used to be sent as incident.opened. Treat alert.summary as a burst, not as a new incident.
- test: someone pressed Send test. Nothing is down. test is true. message is the sentence that says this is a test. channel is the channel name, or null. summary repeats that sentence. incident and monitor are null.