add URL to slack notification

pull/3541/head
Michał Wójcik 9 months ago
parent 4377f575d1
commit ed44c23fa3
No known key found for this signature in database
GPG Key ID: 6D108A166EAE5B01

@ -27,6 +27,11 @@ class Slack extends NotificationProvider {
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; let okMsg = "Sent Successfully.";
if (notification.slackchannelnotify) {
msg += " <!channel>";
}
try { try {
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let data = { let data = {
@ -53,7 +58,7 @@ class Slack extends NotificationProvider {
"type": "header", "type": "header",
"text": { "text": {
"type": "plain_text", "type": "plain_text",
"text": "Uptime Kuma Alert", "text": textMsg,
}, },
}, },
{ {
@ -62,15 +67,14 @@ class Slack extends NotificationProvider {
"type": "mrkdwn", "type": "mrkdwn",
"text": "*Message*\n" + msg, "text": "*Message*\n" + msg,
}, },
{ {
"type": "mrkdwn", "type": "mrkdwn",
"text": `*Time (${heartbeatJSON["timezone"]})*\n${heartbeatJSON["localDateTime"]}`, "text": `*Time (${heartbeatJSON["timezone"]})*\n${heartbeatJSON["localDateTime"]}`,
}, },
{ {
"type": "mrkdwn", "type": "mrkdwn",
"text": "*URL*\n" + monitorJSON.url, "text": "*URL*\n" + monitorJSON.url,
}], }],
} }
], ],
} }

Loading…
Cancel
Save