Incident response
Create one notification per incident. Keep the main content as the current summary, append investigation history, and add named slots when a human decision is needed.
open incident
const incident = await roundtrip.notify({
channel: "on-call",
push: {
title: "Checkout is failing",
body: "Error rate above 12%",
priority: "critical",
},
content: {
title: "Checkout incident",
description: "Error rate above threshold.",
status: "error",
},
metadata: { incidentId: "inc_42" },
idempotency: ["incident", "inc_42", "open"],
});timeline
await incident.content.append({
content: {
title: "Payment provider healthy",
description: "No provider-side errors detected.",
status: "success",
},
});
await incident.content.append({
content: {
title: "Regression isolated",
description: "Checkout retry patch introduced duplicate token use.",
status: "warning",
},
});decision slot
const incidentWorkflow = roundtrip.webhooks.workflow({
name: "incident",
actions: {
decision: ["rollback", "wait"] as const,
},
});
await incident.content.replace("decision", {
content: {
title: "Approve rollback?",
description: "Rollback candidate is ready.",
status: "warning",
actions: incidentWorkflow.actions("decision", {
rollback: { label: "Rollback", style: "destructive" },
wait: { label: "Wait", style: "secondary" },
}),
},
response: {
mode: "required",
behavior: "resolve",
webhook: "https://api.example.com/roundtrip/webhooks",
},
metadata: { incidentId: "inc_42" },
});When the incident is over, replace the main content and cancel any stale decision slot by replacing it with closed status.