diff --git a/src/helpers/notifications.ts b/src/helpers/notifications.ts index 4e5d9f97..8c80ede1 100644 --- a/src/helpers/notifications.ts +++ b/src/helpers/notifications.ts @@ -27,6 +27,10 @@ export const sendNotification = async (config: UpptimeConfig, text: string) => { { channel: notification.channel, text }, { headers: { Authorization: `Bearer ${getSecret("SLACK_BOT_ACCESS_TOKEN")}` } } ); + } else if (notification.type === "googlechat") { + console.log("[debug] Sending Google Chat notification"); + const webhookUrl = getSecret("GOOGLE_CHAT_WEBHOOK_URL"); + if (webhookUrl) await axios.post(webhookUrl, { "text": text }); } else if (notification.type === "discord") { console.log("[debug] Sending Discord notification"); const webhookUrl = getSecret("DISCORD_WEBHOOK_URL"); diff --git a/src/helpers/notifme.ts b/src/helpers/notifme.ts index 00cc6cbc..4222c486 100644 --- a/src/helpers/notifme.ts +++ b/src/helpers/notifme.ts @@ -226,6 +226,18 @@ export const sendNotification = async (message: string) => { } console.log("Finished sending Discord"); } + if (getSecret("NOTIFICATION_GOOGLE_CHAT_WEBHOOK_URL")) { + console.log("Sending Google Chat"); + try { + await axios.post(getSecret("NOTIFICATION_GOOGLE_CHAT_WEBHOOK_URL") as string, { + text: message, + }); + console.log("Success Google Chat"); + } catch (error) { + console.log("Got an error", error); + } + console.log("Finished sending Google Chat"); + } if ( getSecret("NOTIFICATION_ZULIP_MESSAGE_URL") && getSecret("NOTIFICATION_ZULIP_API_EMAIL") &&