Repository: louislam/uptime-kuma
File: server/notification.js (JavaScript)

Code before:
              return false;
            }

        } else if (notification.type === "signal") {
          try {
            let data = {
              "message": msg,
              "number": notification.signalNumber,
              "recipients": notification.signalRecipients.replace(/\s/g, '').split(",")
            };
            let config = {};

            await axios.post(notification.signalURL, data, config)
            return true;
        } catch (error) {
            console.error(error)
            return false;
        }

        } else if (notification.type === "slack") {
            try {
                if (heartbeatJSON == null) {
                    let data = {'text': "Uptime Kuma Slack testing successful.", 'channel': notification.slackchannel, 'username': notification.slackusername, 'icon_emoji': notification.slackiconemo}
                    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": {
                                "type": "plain_text",
                                "text": "Uptime Kuma Alert"
                            }
                        },
                        {
                            "type": "section",
                            "fields": [{
                                    "type": "mrkdwn",
                                    "text": '*Message*\n'+msg
                                },
                                {
                                    "type": "mrkdwn",
                                    "text": "*Time (UTC)*\n"+time
                                }

Review comment (suggestion):
```suggestion
                    await axios.post(notification.slackwebhookURL, data)
                    return true;
```

Code after:
              return false;
            }

        } else if (notification.type === "signal") {
          try {
            let data = {
              "message": msg,
              "number": notification.signalNumber,
              "recipients": notification.signalRecipients.replace(/\s/g, '').split(",")
            };
            let config = {};

            await axios.post(notification.signalURL, data, config)
            return true;
        } catch (error) {
            console.error(error)
            return false;
        }

        } else if (notification.type === "slack") {
            try {
                if (heartbeatJSON == null) {
                    let data = {'text': "Uptime Kuma Slack testing successful.", 'channel': notification.slackchannel, 'username': notification.slackusername, 'icon_emoji': notification.slackiconemo}
                    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": {
                                "type": "plain_text",
                                "text": "Uptime Kuma Alert"
                            }
                        },
                        {
                            "type": "section",
                            "fields": [{
                                    "type": "mrkdwn",
                                    "text": '*Message*\n'+msg
                                },
                                {
                                    "type": "mrkdwn",
                                    "text": "*Time (UTC)*\n"+time
                                }
                            ]