The Array Aggregator: Learn How to Use This Tool in a Scenario

The array aggregator is a unique Integromat tool that can take your scenarios to a whole new level. If you wish for a detailed explanation before going into this tutorial, please read this other post covering iterators and array aggregators

What this scenario does: Retrieves files from a folder in Google Drive, aggregates the files and sends them as attachments in a single mail. 

Level Of Difficulty: Beginner 

Implementation Time: Approximately 15 mins 

Assumptions: You have a Google account for Google Drive and Gmail. 

This tutorial focuses on one of Integromat’s most powerful inbuilt tools, the Array Aggregator. The function of this tool is to combine multiple bundles of data into a single array containing collections of specified items. 

The purpose of the Array Aggregator in this specific scenario is to combine multiple files in order to send them as attachments in 1 email. Without the Array Aggregator, the files are retrieved and emailed one by one resulting in multiple emails being sent.

Configuring the scenario

The scenario consists of the following modules:

  • Google Drive > Watch files in folder
  • Array Aggregator
  • Gmail > Send an email

Here’s the scenario:

Array aggregator module in Integromat

Add the Google Drive > Watch files in the folder module and click on it to configure. Here, select the folder that you want to watch (folder that you upload the files to). You can leave the other fields as is: 

Google Drive watch files Integromat module

Scroll down to the Maximum number of downloaded files. This is the maximum number of downloaded files that will be retrieved in one cycle execution. 

Set this number to 5 so that the email will contain a maximum of 5 attachments: 

Google Drive watch files Integromat module settings

The Array Aggregator is found under tools located at the bottom of the scenario builder: 

Array aggregator module

After adding the Array Aggregator, you need to configure it. Under the Source module, the Google Drive > Watch files in folder module is automatically selected as it’s the only preceding module: 

Array aggregator Integromat module configuration

Next is the Target Structure type. 

It’s important to note that if there is no module attached to the right of the Array Aggregator, (the Gmail module in this case) you’ll only see the custom option available in this menu: 

Array aggregator Integromat module settings

Since the goal is to send an email, you need to add the Gmail > Send an email module after the Array Aggregator. Then, come back to the Array Aggregator to select the Target structure type and you’ll see additional options in this menu. 

Now select the Attachments option which essentially allows you to create an array as per the structure accepted by the Gmail module. 

Following that, select the Google Drive > Watch files in folder module as the Source File:

Array aggregator Integromat module configuration

Next, configure the Gmail module that you just added. Add the recipient, subject line and content of the email: 

Gmail Integromat module

Then, toggle the map switch and simply map the Array[] element outputted by the Array Aggregator to the Attachments field: 

Gmail Integromat module settings

Now you need to right click on the Google Drive module, select where to start processing from and select All files:

Google Drive Integromat module configuration

Testing the scenario

Time to test the scenario. First click on the Save button at the bottom of the screen to save the scenario. 

Next, ensure that you have at least 5 files uploaded to the folder in Google Drive and then click on the Run once button to execute the scenario: 

Testing Integromat scenarioHere you can see that the scenario execution is successful. You can click on the numbered circles to view the output of each module.

This number signifies the number of operations consumed by each module in a single execution: 

Integromat scenario output data

Click on the numbered circle above the Array Aggregator to view the output. Here you can see that 5 bundles pass through from the Google Drive module to the Array Aggregator as an input: 

Integromat scenario output data

The Array Aggregator then combines the 5 bundles in a single array containing collections of the files. 

In other words, the Array Aggregator outputs one bundle of data with multiple collections, each corresponding to a bundle generated by the module whose output you wish to aggregate - the Google Drive module in this case: 

Integromat scenario output data

The bundle passes through to the Gmail module as an input and the result is that the recipient receives 1 email with all 5 attachments as intended: 

More attachments to one email automation

Perfect! Now go back to the scenario and click on the Clock icon to set the schedule of the scenario executions. There are various options to choose from that are self-explanatory: 

Scenario executions settings

Finally, set the scenario to on by clicking the switch at the bottom left corner: 

Run scenario

There you have it. Now you see the power of the Array Aggregator in a scenario. Hope you found this tutorial useful!

Happy Automating! 

Do you like this article?
Don't forget to share it!

Get started now!

Sign up for a free Integromat account today!