Skip to content
betterstack-alchemyUnofficial

Incidents.ResolveIncident

Kind BindingType id BetterStack.Incidents.ResolveIncidentSource src/Incidents/ResolveIncident.ts

Resolve an ongoing incident from running code (resolve_incident) — for example when the job that opened it recovers. resolvedBy credits a person (an e-mail) or any text; it defaults to API with an API token.

Notifies. Everyone who was notified about the incident by e-mail or push gets a “resolved” notification (except whoever resolved it and anyone on holiday); connected integrations such as Slack are updated.

Credential. These operations need an API token: Better Stack has no narrower credential for them (no per-incident or per-page token, no scopes). The host receives the ApiToken you pass — explicitly, never the deployer’s own — under the name you give it (Redacted, a secret on every host), plus <name>_TEAM_ID when you give a team. The token can do everything it can do in the Uptime API, so use a team-scoped Uptime API token (Settings → API tokens) rather than a global one, and bind it only into hosts that need it.

Provide ResolveIncidentHttp on the host’s implementation.

Bind it with an explicit token

export default class Api extends BetterStack.Cloud.Service<Api>()(
"Api",
{ server: Box, main: import.meta.url, port: 3000 },
Effect.gen(function* () {
const resolve = yield* BetterStack.Incidents.ResolveIncident(IncidentsToken);
return {
fetch: Effect.gen(function* () {
yield* resolve({ id: "123", resolvedBy: "bot@example.com" });
return HttpServerResponse.text("resolved");
}).pipe(Effect.orDie),
};
}).pipe(Effect.provide(BetterStack.Incidents.ResolveIncidentHttp)),
) {}

The token and ids are bound through RuntimeContext, so the same yield* BetterStack.Incidents.ResolveIncident(…) works in a Cloudflare Worker or a Lambda Function, where the token becomes the host’s secret.