Skip to content
betterstack-alchemyUnofficial

Incidents.CreateStatusUpdate

Kind BindingType id BetterStack.Incidents.CreateStatusUpdateSource src/Incidents/CreateStatusUpdate.ts

Post a status update to a report on a StatusPage from running code (create_status_update): the next message and the resources’ new states (resolve them to close a manual report). The page is fixed when you bind; each call names the statusReportId.

Notifies. The update is public on the status page at once. Subscribers are notified only with notifySubscribers: true (at publishedAt, which can be in the future): the binding sends false when a call leaves it out, though the API’s own default is to notify.

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 CreateStatusUpdateHttp 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 update = yield* BetterStack.Incidents.CreateStatusUpdate(PublicStatus, IncidentsToken);
return {
fetch: Effect.gen(function* () {
yield* update({
statusReportId: "789",
message: "Payments are back to normal.",
affectedResources: [{ statusPageResourceId: "456", status: "resolved" }],
});
return HttpServerResponse.text("posted");
}).pipe(Effect.orDie),
};
}).pipe(Effect.provide(BetterStack.Incidents.CreateStatusUpdateHttp)),
) {}

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