Skip to main content

Reference

Integration Recipes.

Production-ready code you can paste, plus setup guides for dashboard integrations.

Code.

Paste these into your codebase. Each one works out of the box with a valid API key.

Sentry

typescript

Hook into onError and send upstream failures straight to Sentry with the service name and status as tags.

import * as Sentry from "@sentry/node";
import { checkupstream } from "@checkupstream/sdk";

checkupstream.init({
  sdkKey: process.env.CHECKUPSTREAM_SDK_KEY,
  onError: (error, context) => {
    Sentry.captureException(error, {
      tags: {
        upstream_service: context.service,
        upstream_status: context.status,
      },
    });
  },
});

Next.js

typescript

Use after() to flush telemetry after the response ships. No blocking, no cold start penalty.

import { after } from "next/server";
import { checkupstream } from "@checkupstream/sdk";

checkupstream.init({
  sdkKey: process.env.CHECKUPSTREAM_SDK_KEY,
});

export async function GET() {
  const data = await fetchUpstreamService();

  // Flush telemetry after the response is sent
  after(async () => {
    await checkupstream.flush();
  });

  return Response.json(data);
}

Express

typescript

One line of middleware. Every outbound HTTP call to a known service gets tracked automatically.

import express from "express";
import { checkupstream } from "@checkupstream/sdk";
import { expressMiddleware } from "@checkupstream/sdk/express";

const app = express();

checkupstream.init({
  sdkKey: process.env.CHECKUPSTREAM_SDK_KEY,
});

app.use(expressMiddleware());

app.get("/api/users", async (req, res) => {
  // Calls to Stripe, OpenAI, etc. are
  // automatically tracked
  const users = await db.getUsers();
  res.json(users);
});

app.listen(3000);

GitHub Actions

yaml

Run a health check in CI before you deploy. Fail the build if a critical dependency is down.

name: Dependency Health Check
on:
  pull_request:
    branches: [main]
  schedule:
    - cron: "0 8 * * 1" # Weekly Monday 8am

jobs:
  check-upstream:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run CheckUpstream scan
        run: npx @checkupstream/cli scan
        env:
          CHECKUPSTREAM_API_TOKEN: ${{ secrets.CHECKUPSTREAM_API_TOKEN }}

      - name: Check for critical risks
        run: npx @checkupstream/cli risk --fail-on critical
        env:
          CHECKUPSTREAM_API_TOKEN: ${{ secrets.CHECKUPSTREAM_API_TOKEN }}

Dashboard Setup.

These integrations are configured from the dashboard. No code changes needed.

Get alerts in a Slack channel when upstream services degrade or go down.

  1. 1Go to Settings → Integrations
  2. 2Click "Add to Slack"
  3. 3Pick a channel (we recommend a dedicated #upstream-status)
  4. 4Choose which events to receive: incident.created, incident.resolved, service.degraded, or dependency.risk_changed

You can also configure this through the API. See the Alert Channels docs for the full webhook setup.

PagerDuty

Open Settings

Trigger PagerDuty incidents automatically when an upstream service has a major outage.

  1. 1In PagerDuty, create an Events API v2 integration and copy the routing key
  2. 2Go to Settings → Webhooks in CheckUpstream
  3. 3Add a webhook pointing at https://events.pagerduty.com/integration/<KEY>/enqueue
  4. 4Select incident.created and incident.updated events

CheckUpstream sends standard webhook payloads. PagerDuty auto-resolves when we send incident.resolved.

Need something else?

We support 12 alert channels and 8 SDKs. If your integration isn't here, request it and we'll build it.