From 1935da5b16af5afb8aca7084032435696847d70e Mon Sep 17 00:00:00 2001
From: Niyas <niyasmohammed64@gmail.com>
Date: Sat, 17 Jul 2021 12:47:52 +0530
Subject: [PATCH] Slack Enhancements

---
 server/notification.js | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/server/notification.js b/server/notification.js
index 99cc1568..5639ae9c 100644
--- a/server/notification.js
+++ b/server/notification.js
@@ -128,13 +128,17 @@ class Notification {
         } else if (notification.type === "slack") {
             try {
                 if (heartbeatJSON == null) {
-                    let data = {'text': "Uptime Kuma Slack testing successful."}
+                    let data = {'text': "Uptime Kuma Slack testing successful.", 'channel': notification.slackchannel, 'username': notification.slackusername, 'icon_emoji': notification.slackiconemo}
                     let res = await axios.post(notification.slackwebhookURL, data)
                     return true;
                 }
 
                 const time = heartbeatJSON["time"];
                 let data = {
+                    "text": "Uptime Kuma Alert",
+                    "channel":notification.slackchannel,
+                    "username": notification.slackusername,
+                    "icon_emoji": notification.slackiconemo,
                     "blocks": [{
                             "type": "header",
                             "text": {
@@ -155,17 +159,17 @@ class Notification {
                             ]
                         },
                         {
-                                "type": "actions",
-                                "elements": [
-                                    {
-                                        "type": "button",
-                                        "text": {
+                            "type": "actions",
+                            "elements": [
+                                {
+                                    "type": "button",
+                                    "text": {
                                             "type": "plain_text",
                                             "text": "Visit Uptime Kuma",
                                         },
-                                        "value": "Uptime-Kuma",
-                                        "url": notification.slackbutton
-                                    }
+                                    "value": "Uptime-Kuma",
+                                    "url": "https://github.com/louislam/uptime-kuma" || notification.slackbutton
+                                }
                                 ]
                             }
                         ]