Gmail + OpenAI: one clean newsletter digest email
Your inbox isn’t the problem. It’s the newsletters you actually want to read… scattered across 12 separate emails, mixed with promos, and buried under everything else.
This Gmail OpenAI digest workflow hits marketing managers first (you live on “industry updates”), but founders and busy operators feel it too. Instead of skimming, saving “for later,” then never returning, you get one clean daily email that’s easy to scan in a minute or two.
Below you’ll see how the automation pulls yesterday’s newsletters, summarizes them consistently with OpenAI, then delivers a single HTML digest back to you. No forwarding. No copying into docs. Just one email worth reading.
How This Automation Works
See how this solves the problem:
n8n Workflow Template: Gmail + OpenAI: one clean newsletter digest email
flowchart LR
subgraph sg0["Schedule Flow"]
direction LR
n0@{ icon: "mdi:message-outline", form: "rounded", label: "Get many messages", pos: "b", h: 48 }
n1@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Items", pos: "b", h: 48 }
n2@{ icon: "mdi:message-outline", form: "rounded", label: "Get a message", pos: "b", h: 48 }
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Get message data"]
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Merge"]
n5["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Clean"]
n6["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Create template"]
n7@{ icon: "mdi:message-outline", form: "rounded", label: "Send a message", pos: "b", h: 48 }
n8@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger", pos: "b", h: 48 }
n9@{ icon: "mdi:robot", form: "rounded", label: "Message a model", pos: "b", h: 48 }
n5 --> n9
n4 --> n6
n2 --> n3
n6 --> n7
n1 --> n4
n1 --> n2
n9 --> n1
n3 --> n5
n8 --> n0
n0 --> n1
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n8 trigger
class n9 ai
class n3,n4,n5,n6 code
classDef customIcon fill:none,stroke:none
class n3,n4,n5,n6 customIcon
The Challenge: Too Many Newsletters, Zero Signal
You subscribe with good intentions. A couple of smart operators. A product newsletter. A few competitors. Then reality hits. Each email is a mini-article with three different sections, a sponsor block, and five links you “should” click. You end up triaging instead of learning, and your brain starts treating newsletters like chores. Worse, you miss the good parts because they’re buried under format noise and repeated intros. It’s frustrating, honestly, because the content is valuable. The delivery is the mess.
Individually, each email is manageable. Together, they’re a daily tax. Here’s where it breaks down.
- You reread the same paragraphs while hunting for the one useful takeaway or link.
- Forwarding “this is good” to a teammate turns into a separate task, so it doesn’t happen.
- Important ideas get lost because every sender uses a different layout and tone.
- By the time you’re done skimming, you’ve spent about an hour and still feel behind.
The Fix: One Daily Digest Built From Your Gmail Newsletters
This workflow runs on a daily schedule and turns “yesterday’s newsletter pile” into a single, clean digest email. At the scheduled time (default is 16:00 server time), it searches Gmail for messages from the past day using your query rules, so you can focus on specific senders, labels, or categories. Each matching email is pulled in full, its content is decoded, and key fields like subject, sender name, and date are normalized. Then OpenAI summarizes the email into a consistent JSON structure of topics (titles plus one-line descriptions), even when a single newsletter contains multiple sections. Finally, everything is merged into one list and rendered into a styled HTML email that lands right back in your inbox.
The workflow starts with a scheduled run and a Gmail search window. From there, it loops through each message, asks OpenAI for structured topic summaries, and combines them into one readable format. The last step sends the digest via Gmail, so it feels native, not like another app you have to check.
What Changes: Before vs. After
| What This Eliminates | Impact You’ll See |
|---|---|
|
|
Real-World Impact
Say you receive 12 newsletters per day. If you spend maybe 5 minutes per email to open it, scroll, and decide what matters, that’s about an hour of skimming. With this workflow, the “work” is basically zero: it runs on schedule, processes in the background, and you read one digest in roughly 10 minutes. Even if the AI summary and email build takes a few minutes behind the scenes, you’re not involved, and you’re not context switching all morning.
Requirements
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Gmail to fetch newsletters and send digest.
- OpenAI for structured summaries of each email.
- OpenAI API key (get it from the OpenAI dashboard)
Skill level: Beginner. You’ll connect accounts, tweak a Gmail search query, and paste an API key.
Need help implementing this? Talk to an automation expert (free 15-minute consultation).
The Workflow Flow
A daily schedule kicks it off. At your chosen time (the default is 16:00 on the server), the workflow starts and looks back over “yesterday” so you get a predictable, once-a-day recap.
Gmail finds the right emails. It runs a search query like “from these senders” plus an after: date filter. You can also narrow it using labels (for example, label:Newsletters) so it doesn’t accidentally summarize sensitive or unrelated mail.
Each newsletter is cleaned up and summarized. The workflow loops through the messages one-by-one, extracts the HTML content and the metadata (subject, sender display name, date), then sends that to OpenAI to produce a consistent JSON list of topics. Multi-section newsletters get split into separate items, which is where the digest starts to feel “curated” instead of dumped.
Everything becomes one polished email. All topics are merged into a single list, turned into a styled HTML template with clear titles and short descriptions, and then sent out via Gmail to the recipient you choose (often… you).
You can easily modify the Gmail query to target different senders or labels based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Scheduled Trigger
Set the workflow to run on a schedule using the trigger node.
- Add Scheduled Run Trigger as the trigger node.
- Set the schedule rule to run at
16hours (as configured under rule → interval → triggerAtHour). - Connect Scheduled Run Trigger to Fetch Inbox Messages.
Step 2: Connect Gmail and Fetch Messages
Pull inbox messages that match your query, then iterate through them in batches for processing.
- Open Fetch Inbox Messages and set Operation to
getAlland Return All totrue. - Set the query filter in Filters → q to
=(from:____@____.com) OR (from:____@____.com) OR (from:____@____.com -"____") after:{{ $now.minus({ days: 1 }).toFormat('yyyy/MM/dd') }}. - Credential Required: Connect your gmailOAuth2 credentials in Fetch Inbox Messages.
- Add Iterate Message Batches and connect Fetch Inbox Messages to it to control per-message processing.
Step 3: Set Up Email Retrieval and Normalization
Retrieve each email in full, extract HTML and metadata, and normalize fields for AI summarization.
- Connect Iterate Message Batches to Retrieve Single Email and set Message ID to
={{ $json.id }}. - Credential Required: Connect your gmailOAuth2 credentials in Retrieve Single Email.
- Connect Retrieve Single Email to Extract Email Fields to parse HTML, sender name, and format the date.
- Connect Extract Email Fields to Normalize Email Data to convert the date to
MM.DDand passhtml,subject,from, anddate.
Step 4: Configure AI Summarization and Topic Aggregation
Use the AI model to summarize each message, then merge all topic arrays into a single list for the digest.
- Connect Normalize Email Data to Summarize With AI.
- In Summarize With AI, select model
gpt-4.1-miniand keep JSON Output enabled. - Credential Required: Connect your openAiApi credentials in Summarize With AI.
- Confirm the prompt references dynamic fields like
{{ $json.subject }},{{ $json.from }},{{ $json.date }}, and{{ $json.html }}as configured. - Connect Summarize With AI back to Iterate Message Batches so each message is processed before aggregation.
- Connect Iterate Message Batches to Combine Topics to merge the AI-generated
topicsarrays.
message.content.topics and the digest will be empty.Step 5: Configure the Digest Output Email
Build the HTML digest and send it to your target inbox.
- Connect Combine Topics to Build Email Template to generate the final HTML.
- Connect Build Email Template to Dispatch Email.
- In Dispatch Email, set Send To to
[YOUR_EMAIL]and Subject toYour-subject. - Set Message to
={{ $json.htmlBody }}to use the HTML generated by Build Email Template. - Credential Required: Connect your gmailOAuth2 credentials in Dispatch Email.
[YOUR_EMAIL] and Your-subject before testing; placeholders will cause delivery failures or confusing test emails.Step 6: Test and Activate Your Workflow
Validate the end-to-end flow and then enable the schedule.
- Click Execute Workflow to run a manual test.
- Confirm that Fetch Inbox Messages returns items and Dispatch Email sends a digest email.
- Open the delivered email to verify that HTML rendering looks correct and topics are grouped as expected.
- Toggle the workflow Active to enable scheduled runs from Scheduled Run Trigger.
Watch Out For
- Gmail OAuth permissions need both read and send access. If the digest stops sending, check the connected Gmail account in n8n credentials first.
- If you’re summarizing a lot of big HTML emails, processing times vary. If downstream nodes produce empty output, widen your wait/loop settings or reduce the number of newsletters included.
- Default prompts in AI nodes are generic. Add brand voice rules (tone, language, what to ignore) early or you will be cleaning up summaries every day.
Common Questions
About 30 minutes if your Gmail and OpenAI accounts are ready.
Yes. No coding required, but you do need to be comfortable editing a Gmail search query and pasting an API key.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API costs, which are usually a few cents per digest depending on email size and count.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Start by changing the Gmail search query in the “Fetch Inbox Messages” step so you only include newsletters (labels, senders, or categories). Then adjust the prompt in “Summarize With AI” to match your preferred language and what counts as a “topic” for your team. Common tweaks include ignoring sponsor blocks, splitting long newsletters into more items, and changing the digest subject line to include the date.
Usually it’s expired or revoked Gmail OAuth permissions. Reconnect the Gmail credential in n8n and confirm it has permission to read messages and send email. If it still fails, check that your Gmail query isn’t returning zero results and that your account isn’t hitting rate limits from pulling too many messages at once.
On self-hosted n8n, executions are only limited by your server and Gmail/OpenAI usage limits.
For this specific job, n8n tends to be the better fit because it’s comfortable with “loop through many emails, transform content, merge results, then generate HTML” workflows. Zapier and Make can do it, but long email parsing plus per-item AI calls gets messy fast, and costs climb as volume grows. n8n also gives you the self-hosting option, which is handy if you want unlimited runs without counting every task. The real deciding factor is control. If you need custom Gmail queries, structured JSON outputs, and a predictable email template, n8n is simply easier to keep stable. Talk to an automation expert if you want a quick recommendation based on your volume.
One email. The useful parts only. Set it up once and let your newsletters finally work for you, not against you.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.