# Aggregate

The **Aggregate** component allows you to collect or group multiple items from a list into a single aggregated output. It is useful when you want to combine, summarize, or bundle list items based on a defined condition or range.

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2F8o8vO9GQkYVhhyC893fP%2Fimage.png?alt=media&#x26;token=4f87bbc3-dcfc-406b-bd06-16f2c73a00d2" alt="Aggregate component card showing its description: Aggregate data based on a condition"><figcaption></figcaption></figure>

### **When to Use the Aggregate Component?**

Use the Aggregate component when you need to:

* Combine multiple list items into a single aggregated result
* Pick a certain number of items from a list in sequence
* Control how many items to aggregate and from where to start

## **How to Configure the Aggregate Component?**

### **Use Case Example**

You want to send a daily summary of the **5 most recent Zendesk support tickets** to a Slack channel. To do this, you will first fetch all tickets from Zendesk, then use the Aggregate component to keep only the last 5.

### **Step 1: Add the Aggregate Component**

* Insert the **Aggregate** component after the step that returns a list of items.
* In this example, add Aggregate **after the "Get Tickets" step from Zendesk**.

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FIvaWoL0Hmts08ti46B8s%2Fimage.png?alt=media&#x26;token=1ddc29aa-b393-4414-bff3-cb3f70552482" alt="Flow builder showing a Zendesk Get Ticket connector step with its Select, Connect, Configure, and Test panel"><figcaption></figcaption></figure>

> **Example:**\
> Step before Aggregate: **Zendesk – Get Tickets** (returns a list of ticket objects)

### **Step 2: Select the Input List**

Inside the Aggregate component, you will configure the following:

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FunqSqg310ufaiWfaYvEw%2Fimage.png?alt=media&#x26;token=343e5d4c-ad01-46cd-ac79-8646dedbbad9" alt="Aggregate step configuration panel showing List, Output Field, Aggregate Strategy, and Aggregate Fields Strategy settings"><figcaption></figcaption></figure>

#### **1. List**

Select the list that needs to be aggregated.

> **Example Value:**\
> `{{steps.getTicket.output.ticket}}`

#### **2. Output Field**

Enter a name for the aggregated result.

> **Example Value:**\
> `AggregateLast5Tickets`

#### **3. Aggregate Strategy**

Choose whether to aggregate **all fields** or **specific fields only** from the list.

* **All Fields** → aggregates all fields from items
* **Individual Fields** → lets you pick only selected fields

> **Example Choice:**\
> **All Fields** (since we want full ticket details)

#### **4. Aggregate Fields Strategy**

Choose how to handle fields selected for aggregation:

* **Includes Only** → include only the fields you select
* **Excludes Only** → exclude fields you don't need

{% hint style="info" %}
**Includes Only**\
(Use this if you only want certain values, like `ticket_id`, `subject`, `status`)
{% endhint %}

#### **5. (Optional) Input Fields**

If you select **Individual Fields**, you can manually specify which fields to include/exclude.

> Example fields you might include for Zendesk tickets:\
> `ticket_id`, `subject`, `priority`, `created_at`

### Final Outcome

* The Aggregate component returns a smaller refined list, e.g., the **5 most recent tickets**.

> You can now use this aggregated output in the next steps, like formatting, generating a summary, or posting to Slack.
