mjsnoxy / Gmail-to-Chat-Webhook

A Google App Script project which searches a Gmail inbox for unread emails that have a given label, then forwards a summary to a Google Chat space via a webhook. This is designed to be used with Google Workspace admin/audit/security alerts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gmail-to-Chat-Webhook

A Google App Script project which searches a Gmail inbox for unread emails that have a given label, then forwards a summary to a Google Chat space via a webhook. This is designed to be used with Google Workspace admin/audit/security alerts.

The code can be easily adapted to forward to any webhook, simply remove the Chat-specific card formatting.

Why?

Workspace should provide a really easy way to send notifications to webhooks - who wants alerts going to a noisy inbox anyway? This script takes advantage of Google's tools for a low effort solution.

Prereqs:

Note an admin user with appropriate permissions will need to configure notifications. See https://support.google.com/a/answer/33325?hl=en

Steps:

Notes

  • App Script quotas do apply. This script is designed to be run by a Workspace account, so the quotas are higher than a consumer Gmail account gets. See https://developers.google.com/apps-script/guides/services/quotas.
  • Unless you have an insane amount of alerts causing the script to take significant time to execute, it's extremely unlikely you'll ever hit the quota - you can run this every minute if you want.
  • App Script has no SLA, so if the script doesn't execute for reasons that aren't quota related or human error in the code, tough.

About

A Google App Script project which searches a Gmail inbox for unread emails that have a given label, then forwards a summary to a Google Chat space via a webhook. This is designed to be used with Google Workspace admin/audit/security alerts


Languages

Language:JavaScript 100.0%