⚡ On-demand email newsletter summaries from Gmail to Telegram with GPT-4.1-mini

686 views · ⚡ Personal Productivity

Description

Summary

Send a number to your Telegram bot (e.g., 2) and get a neatly formatted digest of all Gmail newsletters received since that date. Each email is summarized by an LLM into concise topics, merged into a single Telegram message, automatically split into chunks to fit Telegram limits, and safely formatted as HTML.

What this workflow does

Apps and credentials

Typical use cases

How it works (node-by-node)

Node map

NodeTypePurpose
Telegram TriggerTriggerReceive daysAgo command from Telegram
Get daysCodeCompute Gmail after:YYYY/MM/DD from daysAgo
Get many messagesGmail (getAll)Search emails since date with custom from: filters
Loop Over ItemsSplit in BatchesIterate messages one-by-one
Get a messageGmail (get)Fetch full message payload
Get message dataCodeExtract HTML/subject/from/date; normalize sender and date
CleanCodeReformat date and forward fields to LLM
Message a modelOpenAISummarize email into JSON topics
MergeCodeMerge topics from all emails
Create TG messageCodeBuild human-friendly digest text
SplitCodeChunk into 3 500‑char parts
SanitizeCodeEscape HTML and map Markdown to Telegram HTML
Send a messageTelegramDeliver digest to Telegram chat

Before you start

Setup instructions

  1. Telegram
  1. Gmail
  1. OpenAI
  1. Safety and formatting

How to use

Customization ideas

Limits and notes

Privacy and safety

Sample output format (Telegram)

  1. Bold topic title

One-sentence description

Original Subject Line → Sender Name — DD.MM.YYYY

  1. Next topic title

Tips and troubleshooting

Tags

Changelog

🔗 Nodes Used

Telegram, Telegram Trigger, Gmail, OpenAI

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup