mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-20 15:51:14 +08:00
feat: Templating and plaintext for Google Workspace Notification Provider (#6048)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user