diff --git a/server/notification-providers/yzj.js b/server/notification-providers/yzj.js
new file mode 100644
index 000000000..6bd3cba51
--- /dev/null
+++ b/server/notification-providers/yzj.js
@@ -0,0 +1,57 @@
+const NotificationProvider = require("./notification-provider");
+const { DOWN, UP } = require("../../src/util");
+const { default: axios } = require("axios");
+
+class YZJ extends NotificationProvider {
+ name = "YZJ";
+
+ /**
+ * @inheritdoc
+ */
+ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
+ let okMsg = "Sent Successfully.";
+
+ try {
+ if (heartbeatJSON !== null) {
+ msg = `${this.statusToString(heartbeatJSON["status"])} ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`;
+ }
+
+ const config = {
+ headers: {
+ "Content-Type": "application/json",
+ },
+ };
+ const params = {
+ content: msg
+ };
+ // yzjtype=0 => general robot
+ const url = `${notification.yzjWebHookUrl}?yzjtype=0&yzjtoken=${notification.yzjToken}`;
+
+ const result = await axios.post(url, params, config);
+ if (!result.data?.success) {
+ throw new Error(result.data?.errmsg ?? "yzj's server did not respond with the expected result");
+ }
+ return okMsg;
+ } catch (error) {
+ this.throwGeneralAxiosError(error);
+ }
+ }
+
+ /**
+ * Convert status constant to string
+ * @param {string} status The status constant
+ * @returns {string} status
+ */
+ statusToString(status) {
+ switch (status) {
+ case DOWN:
+ return "❌";
+ case UP:
+ return "✅";
+ default:
+ return status;
+ }
+ }
+}
+
+module.exports = YZJ;
diff --git a/server/notification.js b/server/notification.js
index e7977eb4a..7ed62ffec 100644
--- a/server/notification.js
+++ b/server/notification.js
@@ -69,6 +69,7 @@ const Cellsynt = require("./notification-providers/cellsynt");
const Onesender = require("./notification-providers/onesender");
const Wpush = require("./notification-providers/wpush");
const SendGrid = require("./notification-providers/send-grid");
+const YZJ = require("./notification-providers/yzj");
class Notification {
@@ -154,7 +155,8 @@ class Notification {
new GtxMessaging(),
new Cellsynt(),
new Wpush(),
- new SendGrid()
+ new SendGrid(),
+ new YZJ()
];
for (let item of list) {
if (! item.name) {
diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue
index f6d728029..8a2c6269d 100644
--- a/src/components/NotificationDialog.vue
+++ b/src/components/NotificationDialog.vue
@@ -183,6 +183,7 @@ export default {
"ServerChan": "ServerChan (Server酱)",
"smsc": "SMSC",
"WPush": "WPush(wpush.cn)",
+ "YZJ": "YZJ (云之家自定义机器人)"
};
// Sort by notification name
diff --git a/src/components/notifications/YZJ.vue b/src/components/notifications/YZJ.vue
new file mode 100644
index 000000000..63bc4c530
--- /dev/null
+++ b/src/components/notifications/YZJ.vue
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js
index efa2af5c4..3bf9affd3 100644
--- a/src/components/notifications/index.js
+++ b/src/components/notifications/index.js
@@ -67,6 +67,7 @@ import Cellsynt from "./Cellsynt.vue";
import WPush from "./WPush.vue";
import SIGNL4 from "./SIGNL4.vue";
import SendGrid from "./SendGrid.vue";
+import YZJ from "./YZJ.vue";
/**
* Manage all notification form.
@@ -142,6 +143,7 @@ const NotificationFormList = {
"Cellsynt": Cellsynt,
"WPush": WPush,
"SendGrid": SendGrid,
+ "YZJ": YZJ,
};
export default NotificationFormList;
diff --git a/src/lang/en.json b/src/lang/en.json
index e215f1031..64958cdc6 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -1051,5 +1051,7 @@
"RabbitMQ Password": "RabbitMQ Password",
"rabbitmqHelpText": "To use the monitor, you will need to enable the Management Plugin in your RabbitMQ setup. For more information, please consult the {rabitmq_documentation}.",
"SendGrid API Key": "SendGrid API Key",
- "Separate multiple email addresses with commas": "Separate multiple email addresses with commas"
+ "Separate multiple email addresses with commas": "Separate multiple email addresses with commas",
+ "YZJ Webhook URL": "YZJ Webhook URL",
+ "YZJ Robot Token": "YZJ Robot token"
}