What this scenario does: Retrieves records in Airtable that contain multiple attachments and sends them in one email.
Level Of Difficulty: Intermediate
Implementation Time: Approximately 25 mins
Imagine bombarding someone with several emails with single attachments when you could have sent them all together? Well if you are trying to email multiple attachments from Airtable records, you may face this issue if your scenario isn’t configured correctly. This is how it’s done.
Configuring the scenario
The scenario consists of the following:
- Airtable > Watch records
- HTTP > Get a file
- Array aggregator
- Gmail > Send an email
Here’s the scenario:
Here’s the a record in Airtable that has 3 fields each containing multiple attachments with a total of number 7:
The scenario begins with the Airtable – Watch records module. You need to first add a connection to Integromat or select an existing one. Next, select the Base and Table that contain the records that you want to retrieve:
Select the Trigger field which is a field that contains a Created Time or Last Modified Time. It is necessary to have this field in your table for the trigger to work correctly. Finally select the Label field:
Next is the Iterator. If you take a look at the output of the Airtable module, you will see that the attachments elements are arrays:
You would need to iterate through the arrays in order to obtain the URL for each file that will be retrieved in the subsequent module.
Since there are multiple arrays, this means that the arrays will need to be merged first. Select the merge function found under the functions for working with arrays tab and map the attachments elements within the brackets separated by semicolons:
In the HTTP > Get a file module, simply map the URL element outputted by the Iterator to download all the files:
Next, you need to use the Array Aggregator to combine the multiple files into a single array containing collections of the attachments in order to send them in a single mail.
Under the Source Module, select the Airtable > Watch records module.
Under the Target structure type, select the Gmail > Send an email attachments but in order for this to be an option in this menu, you will need to first add the Gmail module to the scenario. If you don’t add the Gmail module, only the custom option will be available.
And under Source file, select the HTTP > Get a file module:
Finally in the Gmail > Send an email module, add or select your connection, enter the email address, then enter the Subject and the Content.
Lastly, toggle the map switch and map the Array element to the Attachments field:
Now that the scenario is fully configured, let’s go ahead and execute it once.
Here you see that the record with multiple attachments was retrieved, the attachments arrays were merged and iterated, the files were downloaded, aggregated and sent in a single mail as intended:
It’s that easy! Hope you found this quick tutorial useful.