Skip to content

How to Use the Array Aggregator to Save New Followers from Twitter to a Data Store

Mar 19, 2020 | 3 minutes
People with phones sitting on a big Twitter hashtag.

What this scenario does: Retrieves a list of Twitter followers stored in a Data Store, compares it to the latest list retrieved from Twitter and saves the new followers. 

Level Of Difficulty: Intermediate 

Implementation Time: Approximately 15 mins 

Assumptions: You have a Twitter account with the connection added and a Data Store created to store the Twitter followers. 

So your Twitter followers are blowing up and you need to keep track of them? We got you. This tutorial shows you how to use the Array Aggregator and a Data store to save all your new Twitter followers. 

As covered in the beginner tutorial on 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 records (keys containing screen names) retrieved from a Data Store into a single array which enables these keys to be compared to the latest list of screen names retrieved from Twitter. Let’s go.

Configuring the scenario

The scenario consists of the following modules:

  • Data Store > Search records

  • Array Aggregator

  • Twitter > List followers

  • Data Store > Add/replace a record

Here’s the scenario: 

Open the first module in the scenario is the Data Store > Search records module which has a simple configuration. Simply select an existing data store or click the Add button to add a new one. Leave the filter empty: 

Next is the Array Aggregator that you need to configure. The Source module (Data store > Search records) and the Target structure type (Custom) are already pre-selected and can be left as is. Under aggregated fields, tick the Key option: 

Following the Array Aggregator is the Twitter > List followers module which retrieves the latest list of followers. 

To configure it, select By Screen Name under List Followers and enter a number under Limit as this is the maximum number of returned followers Make will generate during one cycle execution: 

The route between the Twitter > List follows and the Data Store > Add/replace a record modules contain a filter. 

The purpose of this filter is to verify if the Keys (Screen names) retrieved from the Data Store does not contain the Screen names outputted by the Twitter module. Only if the bundle meets the criteria of the filter will it pass through to the subsequent module. 

Click on the route to set up the filter. 

To extract an item (the key in this case) and/or extract the value of an item from an array of collections, you need to use the map() function found under the Functions for working with arrays tab: 

Map the Array[] element outputted by the Array Aggregator within the brackets and type in the word key after the semicolon. 

It is important to note here that you should only enter the raw name of the element (key in this case) outputted by the Array Aggregator in the brackets after the semicolon. 

To view the raw name of the element, simply hover over it: 

Next, select the Does not contain text operator and map the Screen name element outputted by the Twitter module: 

Great! The filter is fully set up. If the bundles meet the filter’s criteria, it passes through to the Data Store > Add/replace a record module which adds the new followers to the Data Store. 

Simply select the Data Store and map the Screen name element outputted by the Twitter module to the Key field: 

All set! Below are 2 scenario executions. Let's take a look at the results.

Scenario execution 1

Here you see that the bundles retrieved from the Data store are aggregated, the keys (Screen names) do not contain the screen names outputted by the Twitte__r module and the new followers are added in the Data Store

Scenario execution 2

In this execution, the keys contain all the screen names outputted by the Twitte__r module therefore do not meet the filter’s criteria and are stopped from proceeding to the subsequent module: 

Tada! Now you know how to use an Array Aggregator to update your list of Twitter followers in a Data store.

Happy Automating!


Wayne Govender

Solutions Architect at Make who loves all things tech with a focus on workflow automation. Also enjoys fitness and spending too much time on YouTube.

Like the article? Spread the word.

Get monthly automation inspiration

Join 75,000+ Makers and get the freshest content delivered straight to your inbox.