How to Use Aggregate Node in n8n | Combine & Summarize Data

Learn How to Use Aggregate Node in n8n | Combine & Summarize Data in this comprehensive n8n tutorial. Step-by-step guide with video, code examples, and expert tips from the n8n Zero to Hero course.

Table of Contents

Overview

This lesson is part of the n8n AI Automation - Zero to Hero course, Section: 3. Deep Dive Concepts.

Watch the video above for the full tutorial, or read the written guide below.

What does the Aggregate node do in n8n?

The Aggregate node collapses multiple input items into a single output item so downstream nodes receive one record instead of many. It offers two modes: aggregate individual fields (pulling specific values, like order IDs, into a list) or merge all item data into one combined item. A workflow processing 41 pending orders produces exactly one item from the Aggregate node rather than 41, cutting email and Slack notification floods to a single summary message.

How to configure the Aggregate node to send one summary email instead of many

The Aggregate node inserts between your Switch node output and your action node. Disconnect the Send Email or Slack node from its current input, search the node palette for Aggregate, and drop it in the gap. In the node's configuration panel, choose Individual Fields mode, add the field you want to collect (for example, order_id), and rename the output field to something descriptive like pending_order_ids. Testing the step shows one output item containing a single list field holding all 41 order IDs, rather than 41 separate items.

In the downstream Send Email node, switch the body from a fixed value to an expression and drag the aggregated pending_order_ids field into the body. For the subject line, reference $now to append today's date automatically. Connect the Aggregate node's output to the email node and run the workflow: one email goes out listing every pending order ID, instead of 41 individual emails.

n8n's data model still wraps the Aggregate output in an outer list because every node receives a list of items. That outer list contains exactly one item, which itself holds the aggregated field as an inner list. This is expected behavior, not an error, and it is what prevents the downstream action node from iterating and firing once per original record.

Key Takeaways

  • The Aggregate node always outputs one item regardless of how many items entered it: 41 pending-order records collapse into a single item with one pending_order_ids list field.
  • Individual Fields mode collects specific named field values across all input items into a list; the all-items mode collapses every field from every item into one combined record.
  • Inserting the Aggregate node between a Switch branch and a Send Email or Slack node is the direct fix for notification overload: the action node fires once on one item instead of once per record.
  • The aggregated list can still contain duplicate values (the transcript shows OD00001 appearing multiple times), so the Remove Duplicates node is the recommended next step when unique values are required downstream.
  • A practical homework extension: add a second Switch condition checking both order_priority = high and order_status = pending or processing so delivered, shipped, cancelled, and refunded orders never reach the operations-team notification branch.

Next Steps

Continue your n8n journey with the full n8n AI Automation - Zero to Hero course.

Frequently Asked Questions

The Aggregate node's Individual Fields mode picks specific fields by name, such as order_id, and collects their values across all input items into one list. The all-items mode takes every field from every item and merges them into one combined record. Use Individual Fields when you only need selected values downstream, for example a list of pending order IDs to paste into a single customer-service email body.

The Aggregate node produces one item, but n8n requires every node's output to be a list of items. The outer array is always present; it simply contains exactly one item instead of many. That single item holds the aggregated field, for example pending_order_ids, which is itself an inner list of all the collected values from the original 41 records.

The Aggregate node sits between the Switch node output and the Send Email or Slack node. It collapses all matching records, such as 41 pending orders, into one item before the action node sees any data. The action node then executes exactly once, sending one message with every order ID in the body rather than triggering a separate send per record.

The Switch node branch that routes high-priority orders to the operations team currently checks only order_priority, not order_status. The instructor assigned adding a second condition so the branch fires only when order_priority equals high AND order_status is pending or processing. This prevents delivered, shipped, cancelled, and refunded orders from reaching the operations Slack notification even if they carry high priority.

Dheeraj Sharma

Dheeraj Sharma

AI Systems Builder
Creator of the n8n Zero to Hero course (42 lessons, 31+ hours). I help solopreneurs build AI systems that grow revenue without growing workload.

Get the n8n Mastery Bundle

All workflows, cheat sheets, and premium resources from the entire course in one package.

Get Premium Resources