mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-05-20 14:02:34 +02:00
feat: add notification provider Notifery (#5832)
Some checks failed
Auto Test / auto-test (18, ARM64) (push) Has been cancelled
Auto Test / auto-test (18, macos-latest) (push) Has been cancelled
Auto Test / auto-test (18, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (18, windows-latest) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
Auto Test / armv7-simple-test (18, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / check-linters (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
validate / json-yaml-validate (push) Has been cancelled
validate / validate (push) Has been cancelled
Some checks failed
Auto Test / auto-test (18, ARM64) (push) Has been cancelled
Auto Test / auto-test (18, macos-latest) (push) Has been cancelled
Auto Test / auto-test (18, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (18, windows-latest) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
Auto Test / armv7-simple-test (18, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / check-linters (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
validate / json-yaml-validate (push) Has been cancelled
validate / validate (push) Has been cancelled
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
2b3f49a266
commit
cd6dc144a7
5 changed files with 108 additions and 1 deletions
53
server/notification-providers/notifery.js
Normal file
53
server/notification-providers/notifery.js
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
const { getMonitorRelativeURL, UP } = require("../../src/util");
|
||||||
|
const { setting } = require("../util-server");
|
||||||
|
const NotificationProvider = require("./notification-provider");
|
||||||
|
const axios = require("axios");
|
||||||
|
|
||||||
|
class Notifery extends NotificationProvider {
|
||||||
|
name = "notifery";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
|
const okMsg = "Sent Successfully.";
|
||||||
|
const url = "https://api.notifery.com/event";
|
||||||
|
|
||||||
|
let data = {
|
||||||
|
title: notification.notiferyTitle || "Uptime Kuma Alert",
|
||||||
|
message: msg,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (notification.notiferyGroup) {
|
||||||
|
data.group = notification.notiferyGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Link to the monitor
|
||||||
|
const baseURL = await setting("primaryBaseURL");
|
||||||
|
if (baseURL && monitorJSON) {
|
||||||
|
data.message += `\n\nMonitor: ${baseURL}${getMonitorRelativeURL(monitorJSON.id)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (heartbeatJSON) {
|
||||||
|
data.code = heartbeatJSON.status === UP ? 0 : 1;
|
||||||
|
|
||||||
|
if (heartbeatJSON.ping) {
|
||||||
|
data.duration = heartbeatJSON.ping;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const headers = {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"x-api-key": notification.notiferyApiKey,
|
||||||
|
};
|
||||||
|
|
||||||
|
await axios.post(url, data, { headers });
|
||||||
|
return okMsg;
|
||||||
|
} catch (error) {
|
||||||
|
this.throwGeneralAxiosError(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Notifery;
|
|
@ -13,6 +13,7 @@ const DingDing = require("./notification-providers/dingding");
|
||||||
const Discord = require("./notification-providers/discord");
|
const Discord = require("./notification-providers/discord");
|
||||||
const Elks = require("./notification-providers/46elks");
|
const Elks = require("./notification-providers/46elks");
|
||||||
const Feishu = require("./notification-providers/feishu");
|
const Feishu = require("./notification-providers/feishu");
|
||||||
|
const Notifery = require("./notification-providers/notifery");
|
||||||
const FreeMobile = require("./notification-providers/freemobile");
|
const FreeMobile = require("./notification-providers/freemobile");
|
||||||
const GoogleChat = require("./notification-providers/google-chat");
|
const GoogleChat = require("./notification-providers/google-chat");
|
||||||
const Gorush = require("./notification-providers/gorush");
|
const Gorush = require("./notification-providers/gorush");
|
||||||
|
@ -169,6 +170,7 @@ class Notification {
|
||||||
new YZJ(),
|
new YZJ(),
|
||||||
new SMSPlanet(),
|
new SMSPlanet(),
|
||||||
new SpugPush(),
|
new SpugPush(),
|
||||||
|
new Notifery(),
|
||||||
];
|
];
|
||||||
for (let item of list) {
|
for (let item of list) {
|
||||||
if (! item.name) {
|
if (! item.name) {
|
||||||
|
|
|
@ -168,7 +168,8 @@ export default {
|
||||||
"waha": "WhatsApp (WAHA)",
|
"waha": "WhatsApp (WAHA)",
|
||||||
"gtxmessaging": "GtxMessaging",
|
"gtxmessaging": "GtxMessaging",
|
||||||
"Cellsynt": "Cellsynt",
|
"Cellsynt": "Cellsynt",
|
||||||
"SendGrid": "SendGrid"
|
"SendGrid": "SendGrid",
|
||||||
|
"notifery": "Notifery"
|
||||||
};
|
};
|
||||||
|
|
||||||
// Put notifications here if it's not supported in most regions or its documentation is not in English
|
// Put notifications here if it's not supported in most regions or its documentation is not in English
|
||||||
|
|
49
src/components/notifications/Notifery.vue
Normal file
49
src/components/notifications/Notifery.vue
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
<template>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="notifery-api-key" class="form-label">{{
|
||||||
|
$t("API Key")
|
||||||
|
}}</label>
|
||||||
|
<HiddenInput
|
||||||
|
id="notifery-api-key"
|
||||||
|
v-model="$parent.notification.notiferyApiKey"
|
||||||
|
:required="true"
|
||||||
|
autocomplete="new-password"
|
||||||
|
></HiddenInput>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="notifery-title" class="form-label">{{ $t("Title") }}</label>
|
||||||
|
<input
|
||||||
|
id="notifery-title"
|
||||||
|
v-model="$parent.notification.notiferyTitle"
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
placeholder="Uptime Kuma Alert"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="notifery-group" class="form-label">{{ $t("Group") }}</label>
|
||||||
|
<input
|
||||||
|
id="notifery-group"
|
||||||
|
v-model="$parent.notification.notiferyGroup"
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
:placeholder="$t('Optional')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
|
||||||
|
<a href="https://docs.notifery.com/api/event/" target="_blank">https://docs.notifery.com/api/event/</a>
|
||||||
|
</i18n-t>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import HiddenInput from "../HiddenInput.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
HiddenInput,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -4,6 +4,7 @@ import AliyunSMS from "./AliyunSms.vue";
|
||||||
import Apprise from "./Apprise.vue";
|
import Apprise from "./Apprise.vue";
|
||||||
import Bark from "./Bark.vue";
|
import Bark from "./Bark.vue";
|
||||||
import Bitrix24 from "./Bitrix24.vue";
|
import Bitrix24 from "./Bitrix24.vue";
|
||||||
|
import Notifery from "./Notifery.vue";
|
||||||
import ClickSendSMS from "./ClickSendSMS.vue";
|
import ClickSendSMS from "./ClickSendSMS.vue";
|
||||||
import CallMeBot from "./CallMeBot.vue";
|
import CallMeBot from "./CallMeBot.vue";
|
||||||
import SMSC from "./SMSC.vue";
|
import SMSC from "./SMSC.vue";
|
||||||
|
@ -149,6 +150,7 @@ const NotificationFormList = {
|
||||||
"ZohoCliq": ZohoCliq,
|
"ZohoCliq": ZohoCliq,
|
||||||
"SevenIO": SevenIO,
|
"SevenIO": SevenIO,
|
||||||
"whapi": Whapi,
|
"whapi": Whapi,
|
||||||
|
"notifery": Notifery,
|
||||||
"waha": WAHA,
|
"waha": WAHA,
|
||||||
"gtxmessaging": GtxMessaging,
|
"gtxmessaging": GtxMessaging,
|
||||||
"Cellsynt": Cellsynt,
|
"Cellsynt": Cellsynt,
|
||||||
|
|
Loading…
Add table
Reference in a new issue