All workflows
Gmail logoGoogle Sheets logoTelegram logo

Log alert emails to a sheet and ping Telegram

Turns each new alert email into a row in your spreadsheet and a Telegram message, and never logs the same alert twice.

On new email in Gmail3 apps6 steps

Apps it connects

Authenticate each one once and the workflow is ready to run.

What it does

The integration steps this workflow runs, in the order it first runs them.

  1. 1GmailNew email trigger
  2. 2GmailList emails
  3. 3GmailAdd label to message
  4. 4GmailGet message headers
  5. 5Google SheetsAppend row
  6. 6TelegramSend message

How it works

Everything the template sets up, and what to fill in before the first run.

When mail arrives in Gmail this looks for the alert mail your search matches, writes one row per alert into your spreadsheet and sends a short Telegram message about each. The row records when the alert was sent, how severe its wording is, who it came from, its subject, a short excerpt and the Gmail message id - in that column order, so give your tab those headings.

Nothing is logged twice. Each message is labelled the moment it is picked up, and the Gmail search excludes that label - so a message that has already been filed is never even fetched on a later run. The label goes on before the row is written, deliberately: if a run dies mid-way the alert is missed rather than logged again, and a duplicate row plus a duplicate ping is noise a person has to sort out, while a miss is silent and rare.

New mail is what wakes it, but the sweep is what does the work - so several alerts landing at once are all picked up, not just the first. 'maxAlertsPerRun' bounds both how many messages are read and how many are filed, so a storm of alerts cannot flood the sheet or the chat in one run; the rest are picked up by the next. Your setting is turned into a number first, so a cap of 12 means twelve and not the text '12'.

Severity is read from the words the alert itself uses - warn and degraded, error, failed and outage, critical, fatal and sev1 - and nothing else is inferred about it. The Telegram message carries the severity, the subject, the sender and the time; the excerpt stays in the spreadsheet, so the contents of your mail are not forwarded into a chat.

One message that cannot be filed is logged and skipped rather than ending the run. If Gmail will not give up a message's Date header the row records the time it was filed instead, and says so in the run log.

Fill in 'alertSearch' with a Gmail search that finds your alert mail, 'alertSheetUrl' with the spreadsheet, and 'alertChatId' with the Telegram chat. 'sheetTabName' and 'filedLabel' have working defaults. Naming a sender on the trigger step narrows what wakes it; left empty, any new mail wakes it and the search decides what counts as an alert.

gmailtelegramgoogle sheetsalertsmonitoringemail

Start from a workflow that already works.

Add "Log alert emails to a sheet and ping Telegram" to your workspace, connect its apps, and make it yours. No credit card required.

Free plan available · No credit card required