Templates / Sweep unread Gmail junk to spam with GPT-5, Telegram, and Google Sheets

Sweep unread Gmail junk to spam with GPT-5, Telegram, and Google Sheets

Ready for 3.0

by Friedrich Bremer ✓ · 1 views · created 2026-10-07 · Document Extraction, AI Summarization

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 30 nodes and runs on a schedule (cron 30 5 * * *) (plus 2 other triggers). Along the way it connects Telegram, Gmail, OpenAI and Google Sheets.

How it runs

Trigger: On a schedule (cron 30 5 * * *) (plus 2 other triggers).

  1. ⚙️ Config (Edit Fields (Set)): sets 7 fields: admin_chat_id, language, inbox_query…
  2. Send Error Alert (Telegram): uses Telegram
  3. Normalise Entry (Code): runs custom JavaScript code
  4. Route by Action (Switch): routes items into 1 branches
  5. Recall Undo (Code): runs custom JavaScript code
  6. Ack Undo Tap (Telegram): work with callback
  7. Prep Sweep Input (Code): runs custom JavaScript code
  8. Undo found? (If): checks a condition and branches into true / false
  9. Fetch Inbox (Gmail): get many
  10. Restore from Spam (HTTP Request): calls an HTTP API (POST)

…plus 17 more steps. See the full node list below.

Services it uses

TelegramGmailOpenAIGoogle Sheets

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (12)

From the author

Quick overview This workflow sweeps unread Gmail inbox messages on a schedule or via Telegram, uses OpenAI GPT-5 to identify high-confidence junk from unknown senders, moves selected emails to Gmail Spam, logs each run to Google Sheets, and sends a Telegram…

Excerpt from Friedrich Bremer's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.