Skip to content

feat(slack): Add option to include monitor group name in notifications#6835

Merged
CommanderStorm merged 8 commits intolouislam:masterfrom
dovansy1998:fix_monitor_group_name_1_28
Jan 29, 2026
Merged

feat(slack): Add option to include monitor group name in notifications#6835
CommanderStorm merged 8 commits intolouislam:masterfrom
dovansy1998:fix_monitor_group_name_1_28

Conversation

@dovansy1998
Copy link
Copy Markdown
Contributor

@dovansy1998 dovansy1998 commented Jan 29, 2026

Summary

In this pull request, the following changes are made:

Backend (server/notification-providers/slack.js)

  • Added includeGroupName parameter to buildBlocks() method to conditionally display monitor group path in rich messages
  • Implemented custom message templating support using Liquid templating (similar to Telegram notifications)
  • Modified send() method to:
    • Support templating when slackUseTemplate is enabled
    • Include group name in plain text messages when slackIncludeGroupName is enabled
    • Display group path as italicized context in rich messages when enabled

Frontend (src/components/notifications/Slack.vue)

  • Added checkbox toggle for "Include monitor group name" option
  • Added checkbox toggle for "Use custom message template" option
  • Integrated TemplatedTextarea component for template editing
  • Added computed property for template placeholder with example

Resolves #6467

Details ### Please follow this checklist to avoid unnecessary back and forth (click to expand)
  • ⚠️ If there are Breaking change (a fix or feature that alters existing functionality in a way that could cause issues) I have called them out
  • 🧠 I have disclosed any use of LLMs/AI in this contribution and reviewed all generated content.
  • I understand that I am responsible for and able to explain every line of code I submit.
  • 🔍 Any UI changes adhere to visual style of this project.
  • 🛠️ I have self-reviewed and self-tested my code to ensure it works as expected.
  • 📝 I have commented my code, especially in hard-to-understand areas (e.g., using JSDoc for methods).
  • 🤖 I added or updated automated tests where appropriate.
  • 📄 Documentation updates are included (if applicable).
  • 🧰 Dependency updates are listed and explained.
  • ⚠️ CI passes and is green.

Screenshots for Visual Changes

  • Before
image
  • After
image

@github-actions
Copy link
Copy Markdown
Contributor

Hello and thanks for lending a paw to Uptime Kuma! 🐻👋
As this is your first contribution, please be sure to check out our Pull Request guidelines.
In particular: - Mark your PR as Draft while you’re still making changes - Mark it as Ready for review once it’s fully ready
If you have any design or process questions, feel free to ask them right here in this pull request - unclear documentation is a bug too.

@dovansy1998 dovansy1998 changed the title Add option to include monitor group name in notifications fix: Add option to include monitor group name in notifications Jan 29, 2026
@dovansy1998 dovansy1998 marked this pull request as draft January 29, 2026 03:51
@dovansy1998 dovansy1998 marked this pull request as ready for review January 29, 2026 04:13
@github-actions github-actions bot added the pr:needs review this PR needs a review by maintainers or other community members label Jan 29, 2026
@dovansy1998
Copy link
Copy Markdown
Contributor Author

@imclint21.
Can you review PR #6835 ?

Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one change to how this defaults.

Please post screenshots of how these features interact so that I am sure that you have tested all combinations 😉

I think these are the code paths that are relevant:

  • rich messages true/false + groups true/false + templates false (=> 4 screenshots)
  • templates true (=> one additional screenshot)

* @returns {Array<object>} The rich content blocks for the Slack message
*/
buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg) {
buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg, includeGroupName = false) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg, includeGroupName = false) {
buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg, includeGroupName) {

return okMsg;
}

const includeGroupName = notification.slackIncludeGroupName || false;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous default.
Please also default this way on the frontend.

Suggested change
const includeGroupName = notification.slackIncludeGroupName || false;
const includeGroupName = notification.slackIncludeGroupName || true;

@CommanderStorm CommanderStorm marked this pull request as draft January 29, 2026 11:57
@CommanderStorm CommanderStorm added pr:please address review comments this PR needs a bit more work to be mergable and removed pr:needs review this PR needs a review by maintainers or other community members labels Jan 29, 2026
@dovansy1998
Copy link
Copy Markdown
Contributor Author

rich messages true + groups true + templates false

image

rich messages true + groups false + templates false

image

rich messages false + groups true + templates false

image

rich messages false + groups false + templates false

image

templates true

image

@dovansy1998 dovansy1998 marked this pull request as ready for review January 29, 2026 17:44
@github-actions github-actions bot added pr:needs review this PR needs a review by maintainers or other community members and removed pr:please address review comments this PR needs a bit more work to be mergable labels Jan 29, 2026
@dovansy1998
Copy link
Copy Markdown
Contributor Author

Hi, @CommanderStorm.
I posted screenshots on comment and updated code with suggesting fix.
Please review again.

Comment on lines +182 to +183
const includeGroupName =
notification.slackIncludeGroupName === true || notification.slackIncludeGroupName === "true";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this is done this way.
I think you mean this, right?

Suggested change
const includeGroupName =
notification.slackIncludeGroupName === true || notification.slackIncludeGroupName === "true";
const includeGroupName = notification.slackIncludeGroupName ?? true;

Also, please set this default in the frontend.
To do this, check how other notification providers do this in the mounted hook.

@dovansy1998 dovansy1998 marked this pull request as draft January 29, 2026 19:05
Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dovansy1998 dovansy1998 marked this pull request as ready for review January 29, 2026 19:21
@CommanderStorm CommanderStorm changed the title fix: Add option to include monitor group name in notifications feat(slack): Add option to include monitor group name in notifications Jan 29, 2026
@CommanderStorm CommanderStorm merged commit d189c42 into louislam:master Jan 29, 2026
27 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@dovansy1998 congrats on your first contribution to Uptime Kuma! 🐻
We hope you enjoy contributing to our project and look forward to seeing more of your work in the future! If you want to see your contribution in action, please see our nightly builds here.

@CommanderStorm CommanderStorm added this to the 2.1.0 milestone Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:needs review this PR needs a review by maintainers or other community members

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to include monitor group name in notifications.

2 participants