test alerts

This commit is contained in:
Alex Holliday committed 2026-01-19 21:39:02 +00:00
1 parent 1d36f40caf
commit 7c9410f9d7
12 files changed
+258 -107

No files matched your search

@@ -1,6 +1,11 @@
import type { Monitor, Notification, MonitorStatusResponse } from "@/types/index.js";
import { INotificationProvider } from "@/service/index.js";
import { buildHardwareAlerts, buildHardwareWebhookBody, buildWebhookBody } from "@/service/infrastructure/notificationProviders/utils.js";
import {
buildHardwareAlerts,
buildHardwareWebhookBody,
buildWebhookBody,
getTestMessage,
} from "@/service/infrastructure/notificationProviders/utils.js";
import got from "got";
export class SlackProvider implements INotificationProvider {
@@ -42,6 +47,21 @@ export class SlackProvider implements INotificationProvider {
}
async sendTestAlert(notification: Notification): Promise<boolean> {
return false;
if (!notification.address) {
return false;
}
try {
await got.post(notification.address, {
json: { text: getTestMessage() },
headers: {
"Content-Type": "application/json",
},
responseType: "json",
});
return true;
} catch (error) {
return false;
}
}
}