Email a weekly digest of payment notification emails

Dear n8n enthusiasts,. Task: Dear n8n enthusiasts, Today, I want to share how to build an AI workflow to summarize newsletter emails. Today, I will share with you how to build an AI agent workflow to summarize payment emails. I get about about 15 payment notifications per week and this workflow extracts the top 3 takeaways from each one and sends me a weekly digest every Sunday. My goal is to save you time and give you hands-on practice for n8n, one of the most popular AI workflow platforms out there. Here's what we'll build together: Tag newsletters in Gmail and connect n8n Tag newsletters in Gmail and connect n8n Set up a weekly trigger to fetch newsletters Set up a weekly trigger to fetch newsletters Aggregate and clean all newsletter content Aggregate and clean all newsletter content Create an AI prompt to generate your digest Create an AI prompt to generate your digest Format and email your weekly summary Format and email your weekly summary Here's what we'll build from scratch: Don't worry if this looks complicated. We'll build it step by step. Step 1: Tag newsletters in Gmail and connect n8n First, we need clean data to work with. Open Gmail and create a label called Payments. Then apply this label to your emails manually or set up Gmail filters to tag specific senders: This step matters. The cleaner your data, the easier to build on n8n it will be. Next, connect your n8n account to Gmail: Connect Gmail to n8n. Go to n8n and log in or sign up for the 14-day free trial. From the n8n Overview page, click the dropdown "Create Workflow button" and select Create Credential. Connect Gmail to n8n. Go to n8n and log in or sign up for the 14-day free trial. From the n8n Overview page, click the dropdown "Create Workflow button" and select Create Credential. Gmail Sign In: Type "Gmail" in the search bar, click Continue, then Sign In with Google. Hit Save. Gmail Sign In: Type "Gmail" in the search bar, click Continue, then Sign In with Google. Hit Save. Optional: Get your OpenAI API key. You can go to platform.openai.com to get your own API key. Step 2: Set up a weekly trigger to fetch newsletters This is where you will start using n8n to build your AI workflow. Go to the n8n Overview page and click "Create Workflow." Click Add first step and add the trigger On a schedule. Configure it like this: Trigger interval: Weeks Trigger interval: Weeks Weeks between triggers: 1 Weeks between triggers: 1 Trigger on Weekdays: Sunday Trigger on Weekdays: Sunday Hour: 8 (for 8 AM) Hour: 8 (for 8 AM) This tells your workflow to run every Sunday morning at 8 AM. Next, on your workflow page, add a Gmail node after the trigger by clicking the "+" button and searching for "Gmail." Select "Get many messages" and configure it like this: Credentials: Select the Gmail account you added earlier Credentials: Select the Gmail account you added earlier Resource: Message Resource: Message Operation: Get Many Operation: Get Many Return all: Toggled on Return all: Toggled on Simplify: Toggled off Simplify: Toggled off Filters: Add a Search filter and type in: label:payments AND newer_than:7d Filters: Add a Search filter and type in: label:payments AND newer_than:7d This grabs all emails with the payments label from the past 7 days. Hit "Execute workflow" and your workflow now looks like this: Double-click the "Get many messages" node to see if the right newsletter emails are coming through. You'll see the output on your right. Step 3: Aggregate and clean all newsletter content Add an "Aggregate" node after the Gmail node to combine all your payment content into one chunk for AI to process. Configure it as follows: Aggregate: All Item Data (Into a Single List) Aggregate: All Item Data (Into a Single List) Put Output in Field: data Put Output in Field: data Include: All fields Include: All fields Hit "Execute step" to test the node. Sometimes - the Aggregate node can produce too much text from all emails you'll pull too many emails combined for OpenAI to process. Add a "Code" node after your Aggregate node and name it "Truncate emails." In the Javascript field, paste this code to truncate the emails to 100K characters: Hit "Execute step" to make sure the output works. Your workflow should now have four connected nodes: Step 4: Create an AI prompt to generate your digest This is where the magic happens. Click "+" after the Code node and search for "AI Agent." Configure it as follows: Source for Prompt: Define below Source for Prompt: Define below; tools: n8n. Human role: The original post does not say how a person stayed involved.; limitations: Prerequisites include an n8n account, Gmail access, and an OpenAI or OpenRouter API key. The workflow relies on accurate Gmail labeling; mislabeled emails will be missed or included incorrectly. Truncating to 100k characters may omit data if weekly volume exceeds this limit. Source reliability is secondary (tutorial). Human approval is implied but not explicitly defined as a gate before sending..

Tools

n8n

Published on Agent Work Atlas:

Overview

Dear n8n enthusiasts,

Workflow

Dear n8n enthusiasts, Today, I want to share how to build an AI workflow to summarize newsletter emails. Today, I will share with you how to build an AI agent workflow to summarize payment emails. I get about about 15 payment notifications per week and this workflow extracts the top 3 takeaways from each one and sends me a weekly digest every Sunday. My goal is to save you time and give you hands-on practice for n8n, one of the most popular AI workflow platforms out there. Here's what we'll build together: Tag newsletters in Gmail and connect n8n Tag newsletters in Gmail and connect n8n Set up a weekly trigger to fetch newsletters Set up a weekly trigger to fetch newsletters Aggregate and clean all newsletter content Aggregate and clean all newsletter content Create an AI prompt to generate your digest Create an AI prompt to generate your digest Format and email your weekly summary Format and email your weekly summary Here's what we'll build from scratch: Don't worry if this looks complicated. We'll build it step by step. Step 1: Tag newsletters in Gmail and connect n8n First, we need clean data to work with. Open Gmail and create a label called Payments. Then apply this label to your emails manually or set up Gmail filters to tag specific senders: This step matters. The cleaner your data, the easier to build on n8n it will be. Next, connect your n8n account to Gmail: Connect Gmail to n8n. Go to n8n and log in or sign up for the 14-day free trial. From the n8n Overview page, click the dropdown "Create Workflow button" and select Create Credential. Connect Gmail to n8n. Go to n8n and log in or sign up for the 14-day free trial. From the n8n Overview page, click the dropdown "Create Workflow button" and select Create Credential. Gmail Sign In: Type "Gmail" in the search bar, click Continue, then Sign In with Google. Hit Save. Gmail Sign In: Type "Gmail" in the search bar, click Continue, then Sign In with Google. Hit Save. Optional: Get your OpenAI API key. You can go to platform.openai.com to get your own API key. Step 2: Set up a weekly trigger to fetch newsletters This is where you will start using n8n to build your AI workflow. Go to the n8n Overview page and click "Create Workflow." Click Add first step and add the trigger On a schedule. Configure it like this: Trigger interval: Weeks Trigger interval: Weeks Weeks between triggers: 1 Weeks between triggers: 1 Trigger on Weekdays: Sunday Trigger on Weekdays: Sunday Hour: 8 (for 8 AM) Hour: 8 (for 8 AM) This tells your workflow to run every Sunday morning at 8 AM. Next, on your workflow page, add a Gmail node after the trigger by clicking the "+" button and searching for "Gmail." Select "Get many messages" and configure it like this: Credentials: Select the Gmail account you added earlier Credentials: Select the Gmail account you added earlier Resource: Message Resource: Message Operation: Get Many Operation: Get Many Return all: Toggled on Return all: Toggled on Simplify: Toggled off Simplify: Toggled off Filters: Add a Search filter and type in: label:payments AND newer_than:7d Filters: Add a Search filter and type in: label:payments AND newer_than:7d This grabs all emails with the payments label from the past 7 days. Hit "Execute workflow" and your workflow now looks like this: Double-click the "Get many messages" node to see if the right newsletter emails are coming through. You'll see the output on your right. Step 3: Aggregate and clean all newsletter content Add an "Aggregate" node after the Gmail node to combine all your payment content into one chunk for AI to process. Configure it as follows: Aggregate: All Item Data (Into a Single List) Aggregate: All Item Data (Into a Single List) Put Output in Field: data Put Output in Field: data Include: All fields Include: All fields Hit "Execute step" to test the node. Sometimes - the Aggregate node can produce too much text from all emails you'll pull too many emails combined for OpenAI to process. Add a "Code" node after your Aggregate node and name it "Truncate emails." In the Javascript field, paste this code to truncate the emails to 100K characters: Hit "Execute step" to make sure the output works. Your workflow should now have four connected nodes: Step 4: Create an AI prompt to generate your digest This is where the magic happens. Click "+" after the Code node and search for "AI Agent." Configure it as follows: Source for Prompt: Define below Source for Prompt: Define below

Reported result

The source does not report measured outcomes, success rates, or time savings. It only states the author's intent to save time and provide hands-on practice. No evidence confirms the workflow was executed successfully or delivered the promised digest. A measurable acceptance check would be verifying that the final email contains correctly extracted top 3 takeaways for each payment notification received in the previous week.

Human role

The original post does not say how a person stayed involved.

Limitations

Prerequisites include an n8n account, Gmail access, and an OpenAI or OpenRouter API key. The workflow relies on accurate Gmail labeling; mislabeled emails will be missed or included incorrectly. Truncating to 100k characters may omit data if weekly volume exceeds this limit. Source reliability is secondary (tutorial). Human approval is implied but not explicitly defined as a gate before sending.

Try it

Act as an n8n workflow builder. I need to create a weekly payment digest automation. Inputs: - Gmail account with 'Payments' label applied to relevant emails. - n8n instance with Gmail and OpenAI/OpenRouter credentials. - Target email address for the digest: [replaceable input]. Steps: 1. Create a workflow with a Schedule Trigger (Sunday 8 AM). 2. Add a Gmail node to fetch messages with filter 'label:payments AND newer_than:7d'. 3. Add an Aggregate node to combine items into a single list. 4. Add a Code node to truncate the JSON string to 100,000 characters. 5. Add an AI Agent node using gpt-4o-mini. Prompt it to extract top 3 takeaways per email and format a weekly summary with total spent, count, and largest payment. 6. Add a Code node to convert markdown to HTML. 7. Add a Gmail Send node to email the digest to [replaceable input]. Deliverables: - A JSON export of the n8n workflow. - A sample dry run output showing the extracted takeaways for 3 test emails. Quality Check: - Ensure the AI output is structured and readable. - Verify truncation logic prevents API errors. Safeguards: - Do not enable the workflow for live sending until I confirm the dry run output is correct. - If Gmail credentials fail, stop and ask for re-authentication. - If no emails are found, output a 'No payments this week' message instead of an empty digest.

Original source

Source reports are not independently verified. Publication date is the catalog publication date, not the original article date.

More cases · Office & operations