Skip to content

Commit 97f4d13

Browse files
committed
refactor: use extractAddress() method for monitor address
Address review feedback from CommanderStorm to use the inherited extractAddress() method instead of directly accessing monitorJSON["url"]. This properly handles different monitor types (ping, port, dns, etc.).
1 parent 13b49bb commit 97f4d13

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed

PR_DESCRIPTION.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# feat: add monitored URL link to Google Chat notifications
2+
3+
## Summary
4+
5+
Add the monitored service URL as a clickable link in Google Chat notifications, allowing users to quickly navigate to the affected service for immediate investigation.
6+
7+
Closes #5952
8+
9+
## Changes
10+
11+
- Added URL section to Google Chat card notifications showing the monitored service URL as a clickable hyperlink
12+
- Only displays when the monitor has a URL configured (e.g., HTTP/HTTPS monitors)
13+
14+
## Benefits
15+
16+
- **Faster Incident Response**: Users can instantly access the service URL to assess issues
17+
- **Improved User Experience**: Eliminates the need to manually search for the service URL
18+
- **Streamlined Workflows**: Reduces cognitive load and potential errors by providing direct access
19+
20+
## Code Change
21+
22+
```javascript
23+
// add monitor URL if available
24+
if (monitorJSON && monitorJSON["url"]) {
25+
sectionWidgets.push({
26+
textParagraph: {
27+
text: `<b>URL:</b>\n<a href="${monitorJSON["url"]}">${monitorJSON["url"]}</a>`,
28+
},
29+
});
30+
}
31+
```
32+
33+
## Screenshot
34+
35+
_Google Chat notification will now include a clickable URL section between the Time and the "Visit Uptime Kuma" button._
36+
37+
## Checklist
38+
39+
- [x] Linting passes (`npm run lint`)
40+
- [x] Follows existing code patterns
41+
- [x] No breaking changes

server/notification-providers/google-chat.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ class GoogleChat extends NotificationProvider {
8080
});
8181
}
8282

83-
// add monitor URL if available
84-
if (monitorJSON && monitorJSON["url"]) {
83+
// add monitor address if available
84+
const address = this.extractAddress(monitorJSON);
85+
if (address) {
8586
sectionWidgets.push({
8687
textParagraph: {
87-
text: `<b>URL:</b>\n<a href="${monitorJSON["url"]}">${monitorJSON["url"]}</a>`,
88+
text: `<b>Address:</b>\n${address}`,
8889
},
8990
});
9091
}

0 commit comments

Comments
 (0)