I am trying to create a instagram carousel with mutliple images and / or videos.
I do not know how many media elements there are, so I need to map the data somehow.
Actually in this post here: Airtable -> Instagram Carousel (help with multiple images) someone describes my problem (i am not using airtable but google sheets).
My problem: I have no idea how to implement the proposed solution.
Could anyone help me?
The iterator splits a string into an array so that I have mutliple URLs to work with (it works fine).
The router is supposed to be there so that I can use the array for Facebook and Instagram (actually facebook is disabled).
And I have no idea how I have to configure the array aggregator.
Thanks for any hints
I built an automation that does exactly this with images. First you need to transform the data from your Google sheets into an array that contains a public URL of those files.
Then use the “Parse JSON” module and build out your JSON with this template:
[
{
“files”: [
{
“image_url”: “{{join(map(1.ARRAY_WITH_YOUR_FILE_LINKS; “FILE_URL”); “””,
““media_type””: ““IMAGE””
},
{
““image_url””: “”“)}}”,
“media_type”: “IMAGE”
}
]
}
]
Replace the media type with whatever you are using. This will allow for you to post a carousel with multiple images and videos with varying number of elements. Hope this helps!
Welcome to the Make community!
Aggregators
Every result (item/record) from iterator/list/search/match modules will output a bundle. This can result in multiple bundles, which then trigger multiple operations in future modules (one operation per bundle). To “combine” multiple bundles into a single variable, you’ll need to use an aggregator of some sort.
Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module. The next popular aggregator is the Text Aggregator which is very flexible and can apply to many use-cases like building of JSON, CSV, HTML.
There are other types of aggregator modules, click the below links to find out more:
Array Aggregator – mapping multiple bundles into a complex field
The Array Aggregator module is very powerful because it allows you to build a complex array of collections for a later module’s field to map multiple items (collections) to it.
This is done using the “Target structure type” of an Array Aggregator module.
Here is an example:
As you can see, the “Map” toggle on complex fields are used when you have an array. You can easily build an array variable to map to a future module’s field, by using an Array Aggregator module and select the “Target Structure Type” as the future module’s field you have mapped the array into.
Hope this helps! Let me know if there are any further questions or issues.
— @samliew