diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js
index 971c26e..881ad21 100644
--- a/server/notification-providers/discord.js
+++ b/server/notification-providers/discord.js
@@ -7,7 +7,7 @@ class Discord extends NotificationProvider {
name = "discord";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
const discordDisplayName = notification.discordUsername || "Uptime Kuma";
diff --git a/server/notification-providers/gotify.js b/server/notification-providers/gotify.js
index 9d2d55a..0852618 100644
--- a/server/notification-providers/gotify.js
+++ b/server/notification-providers/gotify.js
@@ -6,7 +6,7 @@ class Gotify extends NotificationProvider {
name = "gotify";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
if (notification.gotifyserverurl && notification.gotifyserverurl.endsWith("/")) {
notification.gotifyserverurl = notification.gotifyserverurl.slice(0, -1);
diff --git a/server/notification-providers/line.js b/server/notification-providers/line.js
index 8309690..327696e 100644
--- a/server/notification-providers/line.js
+++ b/server/notification-providers/line.js
@@ -7,7 +7,7 @@ class Line extends NotificationProvider {
name = "line";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
let lineAPIUrl = "https://api.line.me/v2/bot/message/push";
let config = {
diff --git a/server/notification-providers/lunasea.js b/server/notification-providers/lunasea.js
index fb6cd23..c41f400 100644
--- a/server/notification-providers/lunasea.js
+++ b/server/notification-providers/lunasea.js
@@ -7,7 +7,7 @@ class LunaSea extends NotificationProvider {
name = "lunasea";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
let lunaseadevice = "https://notify.lunasea.app/v1/custom/device/" + notification.lunaseaDevice
try {
diff --git a/server/notification-providers/matrix.js b/server/notification-providers/matrix.js
new file mode 100644
index 0000000..c1054fc
--- /dev/null
+++ b/server/notification-providers/matrix.js
@@ -0,0 +1,45 @@
+const NotificationProvider = require("./notification-provider");
+const axios = require("axios");
+const Crypto = require("crypto");
+const { debug } = require("../../src/util");
+
+class Matrix extends NotificationProvider {
+ name = "matrix";
+
+ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
+ let okMsg = "Sent Successfully.";
+
+ const size = 20;
+ const randomString = encodeURIComponent(
+ Crypto
+ .randomBytes(size)
+ .toString("base64")
+ .slice(0, size)
+ );
+
+ debug("Random String: " + randomString);
+
+ const roomId = encodeURIComponent(notification.internalRoomId);
+
+ debug("Matrix Room ID: " + roomId);
+
+ try {
+ let config = {
+ headers: {
+ "Authorization": `Bearer ${notification.accessToken}`,
+ }
+ };
+ let data = {
+ "msgtype": "m.text",
+ "body": msg
+ };
+
+ await axios.put(`${notification.homeserverUrl}/_matrix/client/r0/rooms/${roomId}/send/m.room.message/${randomString}`, data, config);
+ return okMsg;
+ } catch (error) {
+ this.throwGeneralAxiosError(error);
+ }
+ }
+}
+
+module.exports = Matrix;
diff --git a/server/notification-providers/mattermost.js b/server/notification-providers/mattermost.js
index 9777943..d776284 100644
--- a/server/notification-providers/mattermost.js
+++ b/server/notification-providers/mattermost.js
@@ -7,7 +7,7 @@ class Mattermost extends NotificationProvider {
name = "mattermost";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
const mattermostUserName = notification.mattermostusername || "Uptime Kuma";
// If heartbeatJSON is null, assume we're testing.
diff --git a/server/notification-providers/octopush.js b/server/notification-providers/octopush.js
index 40273f9..9d77aa5 100644
--- a/server/notification-providers/octopush.js
+++ b/server/notification-providers/octopush.js
@@ -6,30 +6,54 @@ class Octopush extends NotificationProvider {
name = "octopush";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
- let config = {
- headers: {
- "api-key": notification.octopushAPIKey,
- "api-login": notification.octopushLogin,
- "cache-control": "no-cache"
- }
- };
- let data = {
- "recipients": [
- {
- "phone_number": notification.octopushPhoneNumber
+ // Default - V2
+ if (notification.octopushVersion == 2 || !notification.octopushVersion) {
+ let config = {
+ headers: {
+ "api-key": notification.octopushAPIKey,
+ "api-login": notification.octopushLogin,
+ "cache-control": "no-cache"
}
- ],
- //octopush not supporting non ascii char
- "text": msg.replace(/[^\x00-\x7F]/g, ""),
- "type": notification.octopushSMSType,
- "purpose": "alert",
- "sender": notification.octopushSenderName
- };
+ };
+ let data = {
+ "recipients": [
+ {
+ "phone_number": notification.octopushPhoneNumber
+ }
+ ],
+ //octopush not supporting non ascii char
+ "text": msg.replace(/[^\x00-\x7F]/g, ""),
+ "type": notification.octopushSMSType,
+ "purpose": "alert",
+ "sender": notification.octopushSenderName
+ };
+ await axios.post("https://api.octopush.com/v1/public/sms-campaign/send", data, config)
+ } else if (notification.octopushVersion == 1) {
+ let data = {
+ "user_login": notification.octopushDMLogin,
+ "api_key": notification.octopushDMAPIKey,
+ "sms_recipients": notification.octopushDMPhoneNumber,
+ "sms_sender": notification.octopushDMSenderName,
+ "sms_type": (notification.octopushDMSMSType == "sms_premium") ? "FR" : "XXX",
+ "transactional": "1",
+ //octopush not supporting non ascii char
+ "sms_text": msg.replace(/[^\x00-\x7F]/g, ""),
+ };
+
+ let config = {
+ headers: {
+ "cache-control": "no-cache"
+ },
+ params: data
+ };
+ await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config)
+ } else {
+ throw new Error("Unknown Octopush version!");
+ }
- await axios.post("https://api.octopush.com/v1/public/sms-campaign/send", data, config)
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
diff --git a/server/notification-providers/pushbullet.js b/server/notification-providers/pushbullet.js
index 0ed6f0f..c7b824a 100644
--- a/server/notification-providers/pushbullet.js
+++ b/server/notification-providers/pushbullet.js
@@ -8,7 +8,7 @@ class Pushbullet extends NotificationProvider {
name = "pushbullet";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
let pushbulletUrl = "https://api.pushbullet.com/v2/pushes";
diff --git a/server/notification-providers/pushover.js b/server/notification-providers/pushover.js
index 2133ca1..77ef1a3 100644
--- a/server/notification-providers/pushover.js
+++ b/server/notification-providers/pushover.js
@@ -6,7 +6,7 @@ class Pushover extends NotificationProvider {
name = "pushover";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
let pushoverlink = "https://api.pushover.net/1/messages.json"
try {
diff --git a/server/notification-providers/pushy.js b/server/notification-providers/pushy.js
index 431cf8c..2bb8993 100644
--- a/server/notification-providers/pushy.js
+++ b/server/notification-providers/pushy.js
@@ -6,7 +6,7 @@ class Pushy extends NotificationProvider {
name = "pushy";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
await axios.post(`https://api.pushy.me/push?api_key=${notification.pushyAPIKey}`, {
diff --git a/server/notification-providers/rocket-chat.js b/server/notification-providers/rocket-chat.js
index a9bd400..25b0b94 100644
--- a/server/notification-providers/rocket-chat.js
+++ b/server/notification-providers/rocket-chat.js
@@ -9,7 +9,7 @@ class RocketChat extends NotificationProvider {
name = "rocket.chat";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
if (heartbeatJSON == null) {
let data = {
diff --git a/server/notification-providers/signal.js b/server/notification-providers/signal.js
index ba5f87f..fee6575 100644
--- a/server/notification-providers/signal.js
+++ b/server/notification-providers/signal.js
@@ -6,7 +6,7 @@ class Signal extends NotificationProvider {
name = "signal";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
let data = {
diff --git a/server/notification-providers/slack.js b/server/notification-providers/slack.js
index 271ee3d..5132ba9 100644
--- a/server/notification-providers/slack.js
+++ b/server/notification-providers/slack.js
@@ -25,7 +25,7 @@ class Slack extends NotificationProvider {
}
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
if (heartbeatJSON == null) {
let data = {
diff --git a/server/notification-providers/teams.js b/server/notification-providers/teams.js
index 72409ff..859af56 100644
--- a/server/notification-providers/teams.js
+++ b/server/notification-providers/teams.js
@@ -87,7 +87,7 @@ class Teams extends NotificationProvider {
};
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
if (heartbeatJSON == null) {
diff --git a/server/notification-providers/telegram.js b/server/notification-providers/telegram.js
index f88dcf5..54d33bf 100644
--- a/server/notification-providers/telegram.js
+++ b/server/notification-providers/telegram.js
@@ -6,7 +6,7 @@ class Telegram extends NotificationProvider {
name = "telegram";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
await axios.get(`https://api.telegram.org/bot${notification.telegramBotToken}/sendMessage`, {
diff --git a/server/notification-providers/webhook.js b/server/notification-providers/webhook.js
index 197e9f9..9cb361f 100644
--- a/server/notification-providers/webhook.js
+++ b/server/notification-providers/webhook.js
@@ -7,7 +7,7 @@ class Webhook extends NotificationProvider {
name = "webhook";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
- let okMsg = "Sent Successfully. ";
+ let okMsg = "Sent Successfully.";
try {
let data = {
diff --git a/server/notification.js b/server/notification.js
index 1344724..207e0a3 100644
--- a/server/notification.js
+++ b/server/notification.js
@@ -5,6 +5,7 @@ const Gotify = require("./notification-providers/gotify");
const Line = require("./notification-providers/line");
const LunaSea = require("./notification-providers/lunasea");
const Mattermost = require("./notification-providers/mattermost");
+const Matrix = require("./notification-providers/matrix");
const Octopush = require("./notification-providers/octopush");
const Pushbullet = require("./notification-providers/pushbullet");
const Pushover = require("./notification-providers/pushover");
@@ -34,6 +35,7 @@ class Notification {
new Line(),
new LunaSea(),
new Mattermost(),
+ new Matrix(),
new Octopush(),
new Pushbullet(),
new Pushover(),
diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue
index c5c98a6..bb320be 100644
--- a/src/components/NotificationDialog.vue
+++ b/src/components/NotificationDialog.vue
@@ -121,7 +121,8 @@ export default {
"apprise": $t("apprise"),
"pushbullet": $t("pushbullet"),
"line": $t("line"),
- "mattermost": $t("mattermostt")
+ "mattermost": $t("mattermostt"),
+ "matrix": $t("matrix"),
}[type];
}
},
diff --git a/src/components/notifications/Matrix.vue b/src/components/notifications/Matrix.vue
new file mode 100644
index 0000000..d1e973c
--- /dev/null
+++ b/src/components/notifications/Matrix.vue
@@ -0,0 +1,34 @@
+
+
+ *
+
+
+
+ *
+
+
+
+ *
+
+
+
+
+ *Required
+
+ You can find the internal room ID by looking in the advanced section of the room settings in your Matrix client. It should look like !QMdRCpUIfLwsfjxye6:home.server.
+
+
+ It is highly recommended you create a new user and do not use your own Matrix user's access token as it will allow full access to your account and all the rooms you joined. Instead, create a new user and only invite it to the room that you want to receive the notification in. You can get the access token by running curl -XPOST -d '{"type": "m.login.password", "identifier": {"user": "botusername", "type": "m.id.user"}, "password": "passwordforuser"}' "https://home.server/_matrix/client/r0/login".
+