summaryrefslogtreecommitdiffstats
path: root/server/notification-providers/keep.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/notification-providers/keep.js')
-rw-r--r--server/notification-providers/keep.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/server/notification-providers/keep.js b/server/notification-providers/keep.js
new file mode 100644
index 0000000..aa65a86
--- /dev/null
+++ b/server/notification-providers/keep.js
@@ -0,0 +1,42 @@
+const NotificationProvider = require("./notification-provider");
+const axios = require("axios");
+
+class Keep extends NotificationProvider {
+ name = "Keep";
+
+ /**
+ * @inheritdoc
+ */
+ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
+ const okMsg = "Sent Successfully.";
+
+ try {
+ let data = {
+ heartbeat: heartbeatJSON,
+ monitor: monitorJSON,
+ msg,
+ };
+ let config = {
+ headers: {
+ "x-api-key": notification.webhookAPIKey,
+ "content-type": "application/json",
+ },
+ };
+
+ let url = notification.webhookURL;
+
+ if (url.endsWith("/")) {
+ url = url.slice(0, -1);
+ }
+
+ let webhookURL = url + "/alerts/event/uptimekuma";
+
+ await axios.post(webhookURL, data, config);
+ return okMsg;
+ } catch (error) {
+ this.throwGeneralAxiosError(error);
+ }
+ }
+}
+
+module.exports = Keep;