Webhooks
A webhook is a URL of yours that Groundbox calls when something happens. Point one at an agent and it hears the moment a CI job fails, then why it failed and what to do, without polling. It can push the fix, rerun the job or tell the person who made the change. Webhooks also tell you when a sandbox starts, pauses, shuts down or ends, when a snapshot is ready, and when a volume is made or deleted.
For people, there is the Groundbox Slack app: failed jobs and why they failed, in a channel.
Add one
In the dashboard, open Webhooks and click Add webhook. Give it an https URL and pick the events. Copy the signing secret it shows: you won't see it again. Or with the API, using a key with webhooks:write:
curl -X POST https://api.groundbox.dev/v1/webhooks \
-H "Authorization: Bearer $GROUNDBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/groundbox",
"events": ["ci.job.failed", "ci.diagnosis.completed", "sandbox.stopped"],
"description": "Fix-it agent"
}'The answer is { webhook, secret }. Leave out events to get every event. Then send a test to check your endpoint answers:
curl -X POST https://api.groundbox.dev/v1/webhooks/whk_.../test \
-H "Authorization: Bearer $GROUNDBOX_API_KEY"Events
| Event | Sent when |
|---|---|
| CI | |
ci.job.failed | A CI job failed |
ci.diagnosis.completed | Why a CI job failed, and what to do |
| Sandboxes | |
sandbox.created | A sandbox was asked for |
sandbox.running | A sandbox is running |
sandbox.paused | A sandbox was paused |
sandbox.resumed | A sandbox was resumed |
sandbox.shut_down | A sandbox was shut down, its disk kept |
sandbox.stopped | A sandbox ended |
sandbox.failed | A sandbox failed |
sandbox.status_changed | Any change of a sandbox's status |
| Snapshots and volumes | |
snapshot.ready | A snapshot is ready |
snapshot.failed | A snapshot failed |
snapshot.deleted | A snapshot was deleted |
volume.created | A volume was made |
volume.deleted | A volume was deleted |
webhook.test | You sent a test. Never sent on its own. |
Every call is a POST with a JSON body: the event's id, type, created_at, team_id and data. These headers come with it:
Groundbox-Signature: t=1796058349,v1=5f0c3b1e9a...
Groundbox-Event: ci.job.failed
Groundbox-Event-Id: evt_3kT9wQ2mZx7LpR4vN8bY
Groundbox-Delivery: whd_9Rk2mQ7xV4bN1pL8
Content-Type: application/json
User-Agent: Groundbox-Webhooks/1ci.job.failed
Sent the moment a job that ran on Groundbox fails or times out. data.job has the repo, branch, commit, the pull request when Groundbox knows it, the job on GitHub (html_url) and in the dashboard (dashboard_url).
{
"id": "evt_3kT9wQ2mZx7LpR4vN8bY",
"type": "ci.job.failed",
"created_at": "2026-11-30T17:05:49.000Z",
"team_id": "6a0e1f3c-2b4d-4c8e-9f1a-7b3d5e9c2a4f",
"data": {
"job": {
"id": "8c1f2a4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b",
"provider": "github",
"repo": "acme/api",
"workflow_name": "CI",
"job_name": "test",
"branch": "fix-retry",
"sha": "4f9d2c1a7b3e8d6f5a2c9e1b4d7f0a3c6e8b2d5f",
"pr_number": 412,
"conclusion": "failure",
"html_url": "https://github.com/acme/api/actions/runs/12345678901/job/34567890123",
"dashboard_url": "https://app.groundbox.dev/ci/8c1f2a4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b",
"started_at": "2026-11-30T17:02:11.000Z",
"completed_at": "2026-11-30T17:05:48.000Z"
}
}
}ci.diagnosis.completed
Sent when CI diagnoses have worked out why a job failed, usually a few minutes after ci.job.failed. Only for teams with CI diagnoses. data.diagnosis has the category, a short summary, the evidence and the next_step; data.job is the same job as above.
{
"id": "evt_8hQ2nV5xC1mK7pW3zL6t",
"type": "ci.diagnosis.completed",
"created_at": "2026-11-30T17:08:31.000Z",
"team_id": "6a0e1f3c-2b4d-4c8e-9f1a-7b3d5e9c2a4f",
"data": {
"diagnosis": {
"id": "dgn_7Hk2Pq9Xw4Lm",
"job_id": "8c1f2a4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b",
"repo": "acme/api",
"job_name": "CI / test",
"head_branch": "fix-retry",
"head_sha": "4f9d2c1a7b3e8d6f5a2c9e1b4d7f0a3c6e8b2d5f",
"pr_number": 412,
"merge_queue": null,
"trigger": "auto",
"status": "done",
"category": "bug_in_change",
"confidence": "high",
"summary": "Your change made retry() give up one try early. The loop in src/retry.ts now stops at attempt < 2, so retry.test.ts fails the same way every time.",
"evidence": [
{
"kind": "command",
"title": "The test fails the same way when run again",
"detail": "$ pnpm vitest run test/retry.test.ts\n × retries three times before giving up\n expected 3 calls, got 2",
"path": "test/retry.test.ts",
"line": 21
},
{
"kind": "diff",
"title": "The change to the loop",
"detail": "- while (attempt < 3) {\n+ while (attempt < 2) {",
"path": "src/retry.ts",
"line": 18
}
],
"next_step": "Change attempt < 2 back to attempt < 3 in src/retry.ts, line 18.",
"used_vm": true,
"error": null,
"feedback": null,
"created_at": "2026-11-30T17:05:50.000Z",
"started_at": "2026-11-30T17:05:52.000Z",
"finished_at": "2026-11-30T17:08:30.000Z"
},
"job": {
"id": "8c1f2a4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b",
"provider": "github",
"repo": "acme/api",
"workflow_name": "CI",
"job_name": "test",
"branch": "fix-retry",
"sha": "4f9d2c1a7b3e8d6f5a2c9e1b4d7f0a3c6e8b2d5f",
"pr_number": 412,
"conclusion": "failure",
"html_url": "https://github.com/acme/api/actions/runs/12345678901/job/34567890123",
"dashboard_url": "https://app.groundbox.dev/ci/8c1f2a4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b",
"started_at": "2026-11-30T17:02:11.000Z",
"completed_at": "2026-11-30T17:05:48.000Z"
}
}
}Sandbox events
A sandbox.* event is sent at each change of a sandbox's status. data.sandbox is the sandbox as GET /v1/sandboxes/{id} shows it when the event is sent, with status and previous_status beside it. sandbox.stopped covers a stop, a delete and a timeout: stop_reason says which. Pick sandbox.status_changed to get every change in one event. This is sandbox.paused:
{
"id": "evt_5pR8kW2nQ7xZ1mL4vB9c",
"type": "sandbox.paused",
"created_at": "2026-11-30T16:52:10.000Z",
"team_id": "6a0e1f3c-2b4d-4c8e-9f1a-7b3d5e9c2a4f",
"data": {
"sandbox": {
"id": "sbx_Q7m2Xk9Lp4Rt",
"status": "paused",
"cpus": 2,
"memory_gb": 4,
"disk_gb": 20,
"booted": {
"cpus": 2,
"memory_mb": 4096
},
"timeout_minutes": 60,
"idle_timeout_seconds": 300,
"on_idle": "pause",
"pause_reason": "idle",
"metadata": {
"agent": "fix-it"
},
"allow_hosts": null,
"flex": false,
"shared_cpu": false,
"forked_from": null,
"template": {
"id": "tpl_4Hn8Wq2Zr6Ty",
"name": "python-ml",
"version": 3
},
"cost_micros": 18400,
"created_at": "2026-11-30T16:40:02.000Z",
"started_at": "2026-11-30T16:40:03.000Z",
"expires_at": "2026-11-30T17:40:03.000Z",
"paused_at": "2026-11-30T16:52:10.000Z",
"stopped_at": null,
"stop_reason": null
},
"status": "paused",
"previous_status": "running"
}
}Snapshot and volume events
data.snapshot has its id, status, the sandbox it was taken of, its label and size_bytes. This is snapshot.ready; snapshot.failed and snapshot.deleted look the same.
{
"id": "evt_2wK7mQ9xR4nL8pZ3vT6b",
"type": "snapshot.ready",
"created_at": "2026-11-30T16:51:44.000Z",
"team_id": "6a0e1f3c-2b4d-4c8e-9f1a-7b3d5e9c2a4f",
"data": {
"snapshot": {
"id": "snap_8Tq3Mw6Xk1Rz",
"status": "ready",
"source_sandbox_id": "sbx_Q7m2Xk9Lp4Rt",
"label": "deps installed",
"size_bytes": 1874329600,
"created_at": "2026-11-30T16:51:30.000Z"
}
}
}data.volume has its id, name, size_gb and status. This is volume.created; volume.deleted has deleted_at set.
{
"id": "evt_9nV3xK6mR1qW8pL2zT5c",
"type": "volume.created",
"created_at": "2026-11-30T16:38:12.000Z",
"team_id": "6a0e1f3c-2b4d-4c8e-9f1a-7b3d5e9c2a4f",
"data": {
"volume": {
"id": "vol_6Rk1Xw9Qm3Lp",
"name": "datasets",
"size_gb": 50,
"status": "ready",
"created_at": "2026-11-30T16:38:12.000Z",
"deleted_at": null
}
}
}webhook.test
{
"id": "evt_1aB2cD3eF4gH5iJ6kL7m",
"type": "webhook.test",
"created_at": "2026-11-30T16:58:02.000Z",
"team_id": "6a0e1f3c-2b4d-4c8e-9f1a-7b3d5e9c2a4f",
"data": {
"message": "A test from Groundbox. Your endpoint is set up."
}
}Retries
- Answer with any 2xx within 10 seconds and the delivery is done. Answer first, then do the work.
- Anything else (an error, a timeout, a 3xx or a 5xx) is tried again after 30 seconds, 2 minutes, 10 minutes, 1 hour, 6 hours and 18 hours: 7 tries in all, over about a day. Then the delivery is marked failed.
- Every try of one event has the same body and the same
id. Keep the ids you have handled and skip a repeat. - Turning a webhook off or deleting it drops what was waiting. A test is tried once.
- Each webhook's recent deliveries, with the tries, the status code or the error, are in its panel on Webhooks and at
GET /v1/webhooks/{id}/deliveries.
Check the signature
Every call is signed with the webhook's secret. The Groundbox-Signature header is t=<unix seconds>,v1=<signature>, where the signature is the hex HMAC-SHA256 of <t>.<raw body> with the secret as the key. Work it out from the raw bytes, before any JSON parsing, compare in constant time, and refuse a t more than 5 minutes from your clock.
import { createHmac, timingSafeEqual } from "node:crypto";
/** True when the body came from Groundbox, signed with your webhook's secret, in the last 5 minutes. */
export function verifyGroundbox(secret, header, rawBody) {
const parts = Object.fromEntries((header ?? "").split(",").map((part) => part.split("=", 2)));
const t = Number(parts.t);
if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > 300) return false;
const expected = createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
const given = Buffer.from(parts.v1 ?? "", "utf8");
return given.length === expected.length && timingSafeEqual(given, Buffer.from(expected, "utf8"));
}
// With Express: read the body raw, so the bytes are the ones that were signed.
app.post("/groundbox", express.raw({ type: "application/json" }), (req, res) => {
if (!verifyGroundbox(process.env.GROUNDBOX_WEBHOOK_SECRET, req.get("Groundbox-Signature"), req.body)) return res.sendStatus(400);
const event = JSON.parse(req.body);
res.sendStatus(200); // answer at once, then do the work
handle(event);
});import hashlib
import hmac
import time
def verify_groundbox(secret: str, header: str, raw_body: bytes) -> bool:
"""True when the body came from Groundbox, signed with your webhook's secret, in the last 5 minutes."""
parts = dict(part.split("=", 1) for part in (header or "").split(",") if "=" in part)
t = parts.get("t", "")
if not t.isdigit() or abs(time.time() - int(t)) > 300:
return False
expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))
# With Flask: request.get_data() is the raw body.
@app.post("/groundbox")
def groundbox():
if not verify_groundbox(os.environ["GROUNDBOX_WEBHOOK_SECRET"], request.headers.get("Groundbox-Signature"), request.get_data()):
return "", 400
event = request.get_json()
queue.put(event) # answer at once, then do the work
return "", 200Limits
- Up to 20 webhooks per team.
- The URL must be https, on a public address. Groundbox does not follow redirects.
- Lost the secret? Delete the webhook and add it again for a new one.
Slack
People get Slack; agents get webhooks. Add the Groundbox Slack app to a channel and Groundbox posts there when a CI job fails: the repo, the job and the branch, with links to the job in Groundbox and on GitHub. When the diagnosis is in, Groundbox edits that same message to say what kind of failure it was, why, and what to do next. No second message.
Under the answer are Right and Wrong. Anyone in the channel can press one. It is kept with the diagnosis, the same as on the job's page, and the message then shows the verdict instead of the buttons.
Add it
On Webhooks, click Add to Slack. Slack asks which channel; pick one and allow it. You come back to Webhooks with the channel open. Add it again for another channel. A team owner or admin adds it, signed in to the dashboard.
The app only posts. It asks Slack for chat:write and incoming-webhook, and reads nothing.
What it posts
- A CI job failed (
ci.job.failed) - Why it failed and what to do (added to the same message) (
ci.diagnosis.completed) - A sandbox failed (
sandbox.failed). Off to start with
A new channel gets failed jobs and why they failed. The answer comes only for teams with CI diagnoses.
Change it
Click the channel on Webhooks. Pick what it posts, send a test, turn it off for a while, or remove it. Removing it stops the posts; to take the app's access away too, remove it from the channel in Slack. If Slack says the app was removed or the channel is gone, Groundbox turns the channel off.
| Endpoint | Scope | What |
|---|---|---|
GET /v1/slack/connections | webhooks:read | The channels, and install_url: the link to add another (null when the Slack app isn't set up). |
PATCH /v1/slack/connections/{id} | webhooks:write | Change what it posts (events), or turn it on or off (enabled). |
DELETE /v1/slack/connections/{id} | webhooks:write | Stop posting to the channel. |
POST /v1/slack/connections/{id}/test | webhooks:write | Post a test message now; the answer says if Slack took it. |
Adding a channel is in a browser only: Slack asks a person which channel.
API
| Endpoint | Scope | What |
|---|---|---|
POST /v1/webhooks | webhooks:write | Add one. The answer has the signing secret, once. |
GET /v1/webhooks | webhooks:read | List them, each with its last delivery. |
GET /v1/webhooks/{id} | webhooks:read | One webhook. |
PATCH /v1/webhooks/{id} | webhooks:write | Change the URL, events or description, or turn it on or off. |
DELETE /v1/webhooks/{id} | webhooks:write | Delete it. What was waiting is dropped. |
POST /v1/webhooks/{id}/test | webhooks:write | Send webhook.test now and answer with how it went. |
GET /v1/webhooks/{id}/deliveries | webhooks:read | The newest 50 deliveries. |
Every endpoint is in the API explorer. The MCP server has them as the webhook_info and webhook tools.