Sweep unread Gmail junk to spam with GPT-5, Telegram, and Google Sheets
Ready for 3.0What 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).
- ⚙️ Config (Edit Fields (Set)): sets 7 fields: admin_chat_id, language, inbox_query…
- Send Error Alert (Telegram): uses Telegram
- Normalise Entry (Code): runs custom JavaScript code
- Route by Action (Switch): routes items into 1 branches
- Recall Undo (Code): runs custom JavaScript code
- Ack Undo Tap (Telegram): work with callback
- Prep Sweep Input (Code): runs custom JavaScript code
- Undo found? (If): checks a condition and branches into true / false
- Fetch Inbox (Gmail): get many
- Restore from Spam (HTTP Request): calls an HTTP API (POST)
…plus 17 more steps. See the full node list below.
Services it uses
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)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Telegram Trigger
n8n-nodes-base.telegramTrigger - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - Switch
n8n-nodes-base.switch - Gmail
n8n-nodes-base.gmail - OpenAI
@n8n/n8n-nodes-langchain.openAi - If
n8n-nodes-base.if - HTTP Request
n8n-nodes-base.httpRequest - Telegram
n8n-nodes-base.telegram - Google Sheets
n8n-nodes-base.googleSheets - Error Trigger
n8n-nodes-base.errorTrigger
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…