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

Code before:
                    "text": {
                        "type": "plain_text",
                        "text": "Visit Uptime Kuma",
                    },
                    "value": "Uptime-Kuma",
                    "url": baseURL + getMonitorRelativeURL(monitorJSON.id),
                });

            }

            if (monitorJSON.url) {
                actions.push({
                    "type": "button",
                    "text": {
                        "type": "plain_text",
                        "text": "Visit site",
                    },
                    "value": "Site",
                    "url": monitorJSON.url,
                });
            }

            const textMsg = "Uptime Kuma Alert";

            //create an array to dynamically add blocks
            const blocks = [];

            // the header block
            blocks.push({
                "type": "header",
                "text": {
                    "type": "plain_text",
                    "text": textMsg,
                },
            });

            // the body block, containing the details
            blocks.push({
                "type": "section",
                "fields": [
                    {
                        "type": "mrkdwn",
                        "text": "*Message*\n" + msg,
                    },
                    {
                        "type": "mrkdwn",
                        "text": `*Time (${heartbeatJSON["timezone"]})*\n${heartbeatJSON["localDateTime"]}`,
                    }
                ],
            });


Review comment (suggestion):
```suggestion
            const blocks = [];
```

Code after:
                "value": "Site",
                "url": monitorJSON.url,
            });
        }

        return actions;
    }

    /**
     * Builds the different blocks the Slack message consists of.
     * @param {string} baseURL Uptime Kuma base URL
     * @param {object} monitorJSON The monitor object
     * @param {object} heartbeatJSON The heartbeat object
     * @param {string} title The message title
     * @param {string} msg The message body
     * @returns {Array<object>} The rich content blocks for the Slack message
     */
    static buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg) {

        //create an array to dynamically add blocks
        const blocks = [];

        // the header block
        blocks.push({
            "type": "header",
            "text": {
                "type": "plain_text",
                "text": title,
            },
        });

        // the body block, containing the details
        blocks.push({
            "type": "section",
            "fields": [
                {
                    "type": "mrkdwn",
                    "text": "*Message*\n" + msg,
                },
                {
                    "type": "mrkdwn",
                    "text": `*Time (${heartbeatJSON["timezone"]})*\n${heartbeatJSON["localDateTime"]}`,
                }
            ],
        });

        const actions = this.buildActions(baseURL, monitorJSON);
        if (actions.length > 0) {
            //the actions block, containing buttons
            blocks.push({
                "type": "actions",