Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360---category: SDKtitle: Notification Servicedescription: "Manage notification channels and providers with the openstatus Node.js SDK"---
Manage notification channels for monitor alerts. Supports 13 providers. The Notification Service provides 7 RPC methods.
## Create Notification
```typescriptimport { createOpenStatusClient, NotificationProvider,} from "@openstatus/sdk-node";
const client = createOpenStatusClient({ apiKey: process.env.OPENSTATUS_API_KEY,});
const { notification } = await client.notification.v1.NotificationService .createNotification({ name: "Slack Alerts", provider: NotificationProvider.SLACK, data: { data: { case: "slack", value: { webhookUrl: "https://hooks.slack.com/services/..." }, }, }, monitorIds: ["123456", "123457"], });
console.log(`Notification created: ${notification?.id}`);```
The `data` field uses a nested oneof pattern: the outer `data` is the `NotificationData` message, and `data.data` is the oneof that selects the provider-specific configuration. The `case` must match the provider type in lowercase.
## Provider Configurations
Each provider shown as a complete `createNotification` call.
### Slack
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "Slack Alerts", provider: NotificationProvider.SLACK, data: { data: { case: "slack", value: { webhookUrl: "https://hooks.slack.com/services/..." }, }, }, monitorIds: ["123456"], });```
### Discord
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "Discord Alerts", provider: NotificationProvider.DISCORD, data: { data: { case: "discord", value: { webhookUrl: "https://discord.com/api/webhooks/..." }, }, }, monitorIds: ["123456"], });```
### Email
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "Email Alerts", provider: NotificationProvider.EMAIL, data: { data: { case: "email", value: { email: "alerts@example.com" }, }, }, monitorIds: ["123456"], });```
### PagerDuty
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "PagerDuty Alerts", provider: NotificationProvider.PAGERDUTY, data: { data: { case: "pagerduty", value: { integrationKey: "your-integration-key" }, }, }, monitorIds: ["123456"], });```
### Opsgenie
```typescriptimport { NotificationProvider, OpsgenieRegion } from "@openstatus/sdk-node";
const { notification } = await client.notification.v1.NotificationService .createNotification({ name: "Opsgenie Alerts", provider: NotificationProvider.OPSGENIE, data: { data: { case: "opsgenie", value: { apiKey: "your-api-key", region: OpsgenieRegion.US }, }, }, monitorIds: ["123456"], });```
### Telegram
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "Telegram Alerts", provider: NotificationProvider.TELEGRAM, data: { data: { case: "telegram", value: { chatId: "123456789" }, }, }, monitorIds: ["123456"], });```
### Google Chat
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "Google Chat Alerts", provider: NotificationProvider.GOOGLE_CHAT, data: { data: { case: "googleChat", value: { webhookUrl: "https://chat.googleapis.com/v1/spaces/..." }, }, }, monitorIds: ["123456"], });```
### Grafana OnCall
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "Grafana OnCall", provider: NotificationProvider.GRAFANA_ONCALL, data: { data: { case: "grafanaOncall", value: { webhookUrl: "https://oncall.example.com/..." }, }, }, monitorIds: ["123456"], });```
### Microsoft Teams
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "Teams Alerts", provider: NotificationProvider.MS_TEAMS, data: { data: { case: "msTeams", value: { webhookUrl: "https://prod-00.westeurope.logic.azure.com:443/workflows/abc/triggers/manual/paths/invoke", }, }, }, monitorIds: ["123456"], });```
### Ntfy
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "Ntfy Alerts", provider: NotificationProvider.NTFY, data: { data: { case: "ntfy", value: { topic: "my-alerts", serverUrl: "https://ntfy.sh", token: "tk_...", }, }, }, monitorIds: ["123456"], });```
### SMS
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "SMS Alerts", provider: NotificationProvider.SMS, data: { data: { case: "sms", value: { phoneNumber: "+1234567890" }, }, }, monitorIds: ["123456"], });```
### WhatsApp
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "WhatsApp Alerts", provider: NotificationProvider.WHATSAPP, data: { data: { case: "whatsapp", value: { phoneNumber: "+1234567890" }, }, }, monitorIds: ["123456"], });```
### Custom Webhook
```typescriptconst { notification } = await client.notification.v1.NotificationService .createNotification({ name: "Custom Webhook", provider: NotificationProvider.WEBHOOK, data: { data: { case: "webhook", value: { endpoint: "https://api.example.com/webhook", headers: [ { key: "Authorization", value: "Bearer token" }, { key: "X-Custom-Header", value: "value" }, ], }, }, }, monitorIds: ["123456"], });```
See the [webhook payload reference](/docs/reference/notification#webhook) for the exact JSON your endpoint receives, the optional fields, and how to authenticate requests.
## Send Test Notification
Verify a notification configuration without creating a channel.
```typescriptimport { NotificationProvider } from "@openstatus/sdk-node";
const { success, errorMessage } = await client.notification.v1 .NotificationService.sendTestNotification({ provider: NotificationProvider.SLACK, data: { data: { case: "slack", value: { webhookUrl: "https://hooks.slack.com/services/..." }, }, }, });
if (success) { console.log("Test notification sent successfully");} else { console.log(`Test failed: ${errorMessage}`);}```
## Check Notification Limits
Check if the workspace has reached its notification channel limit.
```typescriptconst { limitReached, currentCount, maxCount } = await client.notification.v1 .NotificationService.checkNotificationLimit({});
console.log(`${currentCount}/${maxCount} notification channels used`);if (limitReached) { console.log("Notification limit reached โ upgrade your plan");}```
## List / Get / Update / Delete Notifications
### List Notifications
```typescriptconst { notifications, totalSize } = await client.notification.v1 .NotificationService.listNotifications({ limit: 10, offset: 0 });
console.log(`Found ${totalSize} notification channels`);```
### Get Notification
```typescriptimport { NotificationProvider } from "@openstatus/sdk-node";
const { notification } = await client.notification.v1.NotificationService .getNotification({ id: "notif_123" });
console.log(`Name: ${notification?.name}`);console.log(`Provider: ${NotificationProvider[notification?.provider ?? 0]}`);```
### Update Notification
```typescriptconst { notification } = await client.notification.v1.NotificationService .updateNotification({ id: "notif_123", name: "Updated Slack Alerts", monitorIds: ["123456", "123457", "123458"], });```
### Delete Notification
```typescriptconst { success } = await client.notification.v1.NotificationService .deleteNotification({ id: "notif_123" });```