From 4f944cd8698ede40a2c70fadecbbafc0daad58f9 Mon Sep 17 00:00:00 2001 From: Erik <131816546+Erikel746@users.noreply.github.com> Date: Sat, 9 Aug 2025 19:31:44 +0200 Subject: [PATCH] feat: Templating and plaintext for Google Workspace Notification Provider (#6048) Co-authored-by: Frank Elsinga --- server/notification-providers/google-chat.js | 13 ++++++- src/components/notifications/GoogleChat.vue | 36 ++++++++++++++++++++ src/lang/en.json | 2 ++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/server/notification-providers/google-chat.js b/server/notification-providers/google-chat.js index 9e94844d7..93bee604f 100644 --- a/server/notification-providers/google-chat.js +++ b/server/notification-providers/google-chat.js @@ -14,6 +14,18 @@ class GoogleChat extends NotificationProvider { try { // Google Chat message formatting: https://developers.google.com/chat/api/guides/message-formats/basic + if (notification.googleChatUseTemplate && notification.googleChatTemplate) { + // Send message using template + const renderedText = await this.renderTemplate( + notification.googleChatTemplate, + msg, + monitorJSON, + heartbeatJSON + ); + const data = { "text": renderedText }; + await axios.post(notification.googleChatWebhookURL, data); + return okMsg; + } let chatHeader = { title: "Uptime Kuma Alert", @@ -88,7 +100,6 @@ class GoogleChat extends NotificationProvider { } catch (error) { this.throwGeneralAxiosError(error); } - } } diff --git a/src/components/notifications/GoogleChat.vue b/src/components/notifications/GoogleChat.vue index c19cae0de..7b595ed59 100644 --- a/src/components/notifications/GoogleChat.vue +++ b/src/components/notifications/GoogleChat.vue @@ -10,4 +10,40 @@ + +
+
+ + + + + +
+
+ + + + diff --git a/src/lang/en.json b/src/lang/en.json index 2331e29dc..7c9867451 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -645,6 +645,8 @@ "pushyToken": "Device token", "apprise": "Apprise (Support 50+ Notification services)", "GoogleChat": "Google Chat (Google Workspace only)", + "Template plain text instead of using cards": "Template plain text instead of using cards", + "issueWithGoogleChatOnAndroidHelptext": "This also allows to get around bugs upstream like {issuetackerURL}", "wayToGetKookBotToken": "Create application and get your bot token at {0}", "wayToGetKookGuildID": "Switch on 'Developer Mode' in Kook setting, and right click the guild to get its ID", "Guild ID": "Guild ID",