Managing Alerts
Manage alerts throughout their lifecycle.
Listing All Alerts
Section titled “Listing All Alerts”import { BeepsClient } from "@beepsdev/sdk";
const client = new BeepsClient({ accessToken: process.env.BEEPS_ACCESS_TOKEN,});
const alerts = await client.alert.list();
console.log(`Found ${alerts.length} total alerts`);alerts.forEach((alert) => { console.log(`[${alert.severity}] ${alert.title}`);});curl -X GET https://api.beeps.dev/v0/alerts \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"Response:
{ "alerts": [ { "id": "alr_abc123", "organizationId": "org_xyz789", "webhookId": "wh_def456", "title": "High CPU usage on web-01", "message": "CPU usage has exceeded 90% for 5 minutes", "severity": "high", "source": "monitoring", "externalId": "mon-12345", "metadata": { "server": "web-01", "cpu": 92.5 }, "assignedToUserId": null, "resolvedAt": null, "createdAt": "2025-01-15T10:30:00Z", "updatedAt": "2025-01-15T10:30:00Z" } ]}beeps alert list
beeps alert list --jsonTool: beeps_list_alerts
{ "status": "all"}Listing Active Alerts
Section titled “Listing Active Alerts”const activeAlerts = await client.alert.listActive();
console.log(`${activeAlerts.length} active alerts need attention`);Safe Method
Section titled “Safe Method”const result = await client.alert.listActiveSafe();
if (result.error) { console.error("Failed to list alerts:", result.error.message);} else { console.log(`Active alerts: ${result.data.length}`);}curl -X GET https://api.beeps.dev/v0/alerts/active \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"beeps alert list --active
beeps alert list --active --jsonTool: beeps_list_alerts
{ "status": "active"}Or use the dedicated tool:
Tool: beeps_list_active_alerts
{}Listing Resolved Alerts
Section titled “Listing Resolved Alerts”const resolvedAlerts = await client.alert.listResolved();
console.log(`${resolvedAlerts.length} alerts have been resolved`);curl -X GET https://api.beeps.dev/v0/alerts/resolved \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"beeps alert list --resolvedTool: beeps_list_alerts
{ "status": "resolved"}Getting a Specific Alert
Section titled “Getting a Specific Alert”const alert = await client.alert.get("alr_abc123");
console.log(`Title: ${alert.title}`);console.log(`Severity: ${alert.severity}`);console.log(`Status: ${alert.resolvedAt ? "Resolved" : "Active"}`);curl -X GET https://api.beeps.dev/v0/alerts/alr_abc123 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"beeps alert get --alert-id alr_abc123
beeps alert get --alert-id alr_abc123 --jsonTool: beeps_get_alert
{ "alertId": "alr_abc123"}Responding to an Alert
Section titled “Responding to an Alert”Signal that you're working on an alert. This creates a responder record.
const responder = await client.alert.onIt("alr_abc123", { userId: "usr_alice",});
console.log(`${responder.userId} is on it (status: ${responder.status})`);console.log(`Joined at ${responder.joinedAt}`);If userId is not provided, the authenticated user is used:
const responder = await client.alert.onIt("alr_abc123");Safe Method
Section titled “Safe Method”const result = await client.alert.onItSafe("alr_abc123", { userId: "usr_alice",});
if (result.error) { console.error("Failed to respond:", result.error.message);} else { console.log(`Responder joined: ${result.data.id}`);}curl -X POST https://api.beeps.dev/v0/alerts/alr_abc123/on-it \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "userId": "usr_alice" }'Response:
{ "responder": { "id": "rsp_def456", "alertId": "alr_abc123", "organizationId": "org_xyz789", "responderType": "user", "userId": "usr_alice", "status": "on_it", "joinedAt": "2025-01-15T10:35:00Z", "completedAt": null }}beeps alert on-it --alert-id alr_abc123
beeps alert on-it --alert-id alr_abc123 --user-id usr_aliceTool: beeps_on_it
{ "alertId": "alr_abc123"}With a specific user:
{ "alertId": "alr_abc123", "userId": "usr_alice"}Listing Responders
Section titled “Listing Responders”const responders = await client.alert.listResponders("alr_abc123");
responders.forEach((r) => { console.log(`${r.userId || r.integrationId} — ${r.status}`); if (r.prUrl) { console.log(` PR: ${r.prUrl}`); }});Safe Method
Section titled “Safe Method”const result = await client.alert.listRespondersSafe("alr_abc123");
if (result.error) { console.error("Failed to list responders:", result.error.message);} else { console.log(`${result.data.length} responders`);}curl -X GET https://api.beeps.dev/v0/alerts/alr_abc123/responders \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"Response:
{ "responders": [ { "id": "rsp_def456", "alertId": "alr_abc123", "organizationId": "org_xyz789", "responderType": "user", "userId": "usr_alice", "status": "on_it", "joinedAt": "2025-01-15T10:35:00Z", "completedAt": null } ]}beeps alert responders --alert-id alr_abc123
beeps alert responders --alert-id alr_abc123 --jsonTool: beeps_list_alert_responders
{ "alertId": "alr_abc123"}Updating Responder Status
Section titled “Updating Responder Status”Mark a responder as done or dropped. You can optionally attach a PR URL when completing work.
const updated = await client.alert.updateResponderStatus( "alr_abc123", "rsp_def456", { status: "done", prUrl: "https://github.com/org/repo/pull/42", },);
console.log(`Responder status: ${updated.status}`);console.log(`Completed at: ${updated.completedAt}`);Safe Method
Section titled “Safe Method”const result = await client.alert.updateResponderStatusSafe( "alr_abc123", "rsp_def456", { status: "done" },);
if (result.error) { console.error("Failed to update:", result.error.message);} else { console.log("Responder marked as done");}curl -X PATCH https://api.beeps.dev/v0/alerts/alr_abc123/responders/rsp_def456 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "status": "done", "prUrl": "https://github.com/org/repo/pull/42" }'Response:
{ "responder": { "id": "rsp_def456", "status": "done", "prUrl": "https://github.com/org/repo/pull/42", "completedAt": "2025-01-15T11:00:00Z" }}Tool: beeps_update_responder_status
{ "alertId": "alr_abc123", "responderId": "rsp_def456", "status": "done", "prUrl": "https://github.com/org/repo/pull/42"}Assigning an Alert
Section titled “Assigning an Alert”const assigned = await client.alert.assign("alr_abc123", "usr_bob");
console.log(`Alert assigned to ${assigned.assignedToUserId}`);Safe Method
Section titled “Safe Method”const result = await client.alert.assignSafe("alr_abc123", "usr_bob");
if (result.error) { console.error("Failed to assign:", result.error.message);} else { console.log(`Assigned to ${result.data.assignedToUserId}`);}curl -X POST https://api.beeps.dev/v0/alerts/alr_abc123/assign \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "userId": "usr_bob" }'Response:
{ "alert": { "id": "alr_abc123", "assignedToUserId": "usr_bob", "updatedAt": "2025-01-15T10:40:00Z" }}beeps alert assign --alert-id alr_abc123 --user-id usr_bobTool: beeps_assign_alert
{ "alertId": "alr_abc123", "userId": "usr_bob"}Snoozing an Alert
Section titled “Snoozing an Alert”Temporarily silence an alert without resolving it. The alert stays active, but paging and notifications are paused until the snooze window expires, after which they resume automatically. Useful when a fix is in flight and you don't want responders re-paged in the meantime.
const snoozed = await client.alert.snooze("alr_abc123", { minutes: 30 });
console.log(`Alert snoozed until ${snoozed.snoozedUntil}`);Safe Method
Section titled “Safe Method”const result = await client.alert.snoozeSafe("alr_abc123", { minutes: 30 });
if (result.error) { console.error("Failed to snooze:", result.error.message);} else { console.log(`Snoozed until ${result.data.snoozedUntil}`);}curl -X POST https://api.beeps.dev/v0/alerts/alr_abc123/snooze \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "minutes": 30 }'Response:
{ "alert": { "id": "alr_abc123", "snoozedUntil": "2025-01-15T11:15:00Z", "updatedAt": "2025-01-15T10:45:00Z" }}beeps alert snooze --alert-id alr_abc123 --minutes 30Tool: beeps_snooze_alert
{ "alertId": "alr_abc123", "minutes": 30}Resolving an Alert
Section titled “Resolving an Alert”const resolved = await client.alert.resolve("alr_abc123");
console.log(`Alert resolved at ${resolved.resolvedAt}`);Safe Method
Section titled “Safe Method”const result = await client.alert.resolveSafe("alr_abc123");
if (result.error) { console.error("Failed to resolve:", result.error.message);} else { console.log("Alert resolved");}curl -X POST https://api.beeps.dev/v0/alerts/alr_abc123/resolve \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"Response:
{ "alert": { "id": "alr_abc123", "resolvedAt": "2025-01-15T10:45:00Z", "updatedAt": "2025-01-15T10:45:00Z" }}beeps alert resolve --alert-id alr_abc123Tool: beeps_resolve_alert
{ "alertId": "alr_abc123"}Type Definitions
Section titled “Type Definitions”type Alert = { id: string; organizationId: string; webhookId: string; title: string; message: string | null; severity: AlertSeverity; source: string; externalId: string | null; metadata: Record<string, unknown> | null; assignedToUserId: string | null; resolvedAt: string | null; resolvedBy: ResolutionSource | null; resolvedByUserId: string | null; resolvedByProvider: string | null; createdAt: string; updatedAt: string;};AlertSeverity
Section titled “AlertSeverity”type AlertSeverity = "critical" | "high" | "medium" | "low" | "info";ResolutionSource
Section titled “ResolutionSource”type ResolutionSource = "user" | "monitoring_system";AlertResponder
Section titled “AlertResponder”type AlertResponder = { id: string; alertId: string; organizationId: string; responderType: ResponderType; userId: string | null; integrationId: string | null; agentSessionId: string | null; status: ResponderStatus; prUrl: string | null; joinedAt: string; completedAt: string | null;};ResponderType
Section titled “ResponderType”type ResponderType = "user" | "agent";ResponderStatus
Section titled “ResponderStatus”type ResponderStatus = "on_it" | "done" | "dropped";OnItInput
Section titled “OnItInput”type OnItInput = { userId?: string;};UpdateResponderStatusInput
Section titled “UpdateResponderStatusInput”type UpdateResponderStatusInput = { status: "done" | "dropped"; prUrl?: string;};SnoozeInput
Section titled “SnoozeInput”type SnoozeInput = { minutes: number;};Common Patterns
Section titled “Common Patterns”Complete Alert Workflow
Section titled “Complete Alert Workflow”const alertId = "alr_abc123";const userId = "usr_alice";
const alert = await client.alert.get(alertId);console.log(`New alert: ${alert.title}`);
const responder = await client.alert.onIt(alertId, { userId });console.log(`On it: ${responder.status}`);
await client.alert.assign(alertId, userId);console.log("Assigned to self");
console.log("Working on the issue...");
await client.alert.updateResponderStatus(alertId, responder.id, { status: "done", prUrl: "https://github.com/org/repo/pull/42",});console.log("Responder done");
await client.alert.resolve(alertId);console.log("Resolved");Filter Alerts by Severity
Section titled “Filter Alerts by Severity”const active = await client.alert.listActive();
const critical = active.filter((a) => a.severity === "critical");const high = active.filter((a) => a.severity === "high");
console.log(`Critical: ${critical.length}`);console.log(`High: ${high.length}`);Alert Dashboard
Section titled “Alert Dashboard”const active = await client.alert.listActive();
const stats = { total: active.length, assigned: active.filter((a) => a.assignedToUserId).length, critical: active.filter((a) => a.severity === "critical").length,};
console.log("Alert Dashboard:");console.log(`Total Active: ${stats.total}`);console.log(`Assigned: ${stats.assigned}`);console.log(`Critical: ${stats.critical}`);My Assigned Alerts
Section titled “My Assigned Alerts”const userId = "usr_alice";const active = await client.alert.listActive();
const myAlerts = active.filter((a) => a.assignedToUserId === userId);
console.log(`You have ${myAlerts.length} assigned alerts:`);myAlerts.forEach((alert) => { console.log(`- [${alert.severity}] ${alert.title}`);});Troubleshooting
Section titled “Troubleshooting”Alerts not appearing? See Troubleshooting - Alerts Not Appearing.