Skip to main content
Notifications let you receive alerts when your monitors fail, recover, or meet specific conditions. Configure them directly in your monitor files using the notify DSL.

Defining notifications

Add notifications when creating your monitor:
import { createMonitorBuilder, notify, Frequency, GET, Json } from "@griffin-app/griffin";

const monitor = createMonitorBuilder({
  name: "health-check",
  frequency: Frequency.every(1).minute(),
  notifications: [
    notify.onFailure().toSlack("#alerts"),
    notify.onRecovery().toEmail(["oncall@example.com"]),
  ],
})
  .request("check", { ... })
  .build();

export default monitor;
Notifications are deployed with your monitor when you run griffin apply.

Trigger types

On failure

Fires every time a run fails:
notify.onFailure().toSlack("#alerts")

On recovery

Fires when a monitor succeeds after a failure:
notify.onRecovery().toSlack("#alerts")

On consecutive failures

Fires after N consecutive failed runs:
notify.onConsecutiveFailures(3).toSlack("#alerts")

On success rate below threshold

Fires when the success rate drops below a percentage over a time window:
notify.onSuccessRateBelow(95, 60).toEmail(["team@example.com"])
// 95% threshold over the last 60 minutes

On latency above threshold

Fires when latency exceeds a threshold at a given percentile:
notify.onLatencyAbove({
  threshold_ms: 2000,
  percentile: "p95",
  window_minutes: 30,
}).toSlack("#performance")

Delivery channels

Slack

notify.onFailure().toSlack("#channel-name")
Requires a Slack integration. See Integrations.

Email

notify.onFailure().toEmail(["alice@example.com", "bob@example.com"])
Requires an email integration.

Webhook

notify.onFailure().toWebhook("my-webhook-integration")
The argument is the name of a webhook integration.

Cooldowns

Add a cooldown to prevent alert fatigue. The notification won’t fire again within the cooldown period:
notify.onFailure()
  .withCooldown(15)  // 15 minutes
  .toSlack("#alerts")

Viewing notification activity

# List notification rules
griffin notifications list

# Filter by monitor
griffin notifications list --monitor health-check

# Send a test notification
griffin notifications test --integration slack --channel "#test"