How to use array aggregator to create multiple google docs from template and send them as attachments in 1 mail?

Question!
This is our scenario:

The first aggregator aggregates the airtable bundles (can be 1 or more).
Then I want the create a document from a template to run as many times as there are bundles from the array aggregator before.
Screenshot 2024-07-15 094519

This is an example of some mappings. Then I want each of these docs to be downloaded once, so if there are 8 airtable bundles, it makes 8 google docs from templates and gets the 8 download docs datas. That then goes into an aggregator aswell.

Then I get some nice email text from the bundles with some text aggregators, and then the email comes.

I want it to be sent once, but with all the google docs that were created as attachments. When there is 1 bundle everything works, but if there are more, only 1 bundle gets made from a template and there is 1 bundle in the first array aggregator. So how does that work and what did I do wrong is question #1.
Question #2, how do I write this in the last image above, in the mail module? Do I just do what I am doing and for all the next I write something like if bundle is > or = 3, then do it for number 3, if not, then empty array/space?
I don’t know, but cannot test as the question 1 thing is not working yet.

Let me know!

Hello @Timo345,

Airtable Search Records is going to output multiple bundles, which means everything that comes after it is going to run once for each bundle, except if you have an aggregator, which you do.
You may not need an Array Aggregator after Airtable, and if you remove the Aggregator, you may see some better results.

I see, Did this, but still now really working. There were 4 bundles in the first airtable module, however, it only did the second google docs part once, for the first bundle. The goal is that it does that X amount of times (in this case, 4 times), then the part after the first array aggregator only once and the email only once aswell.

My apologies for steering you in the wrong direction, I must not have a good understanding of the goal of your scenario.

So if there were 4 bundles produced by the Airtable module, that means there were 4 records found by the search.
Are you saying you want to run Google Docs Create a Document from Template and Download a Document once for each of the records/bundles from Airtable?

No worries! Yes correct! So X amount of search results from airtable bundle (from 1 to about 15 results max), then it should make X docs from templates, and get the 15 download doc data from that. Then it should do the next airtable/text aggregator/text aggregator ONCE, then lastly it should send the email ONCE with the X docs attached

Ok so since Airtable is the Iterator you can set Airtable module #4 as the source in the Array Aggregator #13.
In the Email module you’ll need to enable Map option on the Attachments field.
Back in the Array Aggregator #13, set your Target Structure Type to “Email - Send an Email [18]: Attachments”, then that will allow the Array Aggregator to format your attachments correctly for the email module.
The Airtable and Tools modules #1-3 appear to be correct based on your needs.

Thats amazing, works great! Last question, about the mapping in the email. Right now I do this:

For 1 and 2 its great, cause I have a filter for this email, as this email would contain more than 1 bundles, so the text is a bit different etc. So it’s always at least 2. However, it can just be 2. Or just be 3. So from 3 on, I thought I should do something like this:

2 problems:
I get this error, probably because of the emptystring, but idk what else to put there for it to ignore it:
Screenshot 2024-07-17 093347

Second problem is it’s a bit tedious. There can be up to 40/50 bundles, so I would have to do that for a large amount of attachments.
Is there some smart, great thing to do here that I don’t know yet? Just mapping 1 attachment as the whole array without specifying the numbers just only attaches the first bundle

In the Email module, next to the Attachments label you need to switch Map to the On position.
It will switch to just a single field input for attachments.
In that field you map in the output from the Array Aggregator #13.
The array aggregator takes care of correctly mapping all the elements required by Email in the attachments field, all you have to do is select that field in the Array Aggregator’s Data Structure dropdown menu.

I hope that makes sense.

3 Likes

Wow that’s very satisfying and cool, gotta love Make.com!
Thanks for all the help, very much appreciated, I’ll mark it as the solution!
Enjoy your week, much appreciated!

2 Likes