Automation Editor
...
Building Automations
System Utilities

Collector

7min

The Collector system utility app provides triggers and actions for aggregating items into named buckets. The items can later be dumped out from the buckets. The items are stored in the system's database until dumped from a bucket.

As an example, let's build a solution to collect news articles from CNBC and send us a single email once a day with all articles for the previous 24 hours.

We'll start with the CNBC trigger:

Document image


Then use the "collect items into a bucket" to place articles into a named bucket:

Document image


We'll name the bucket "CNBC" and place the article titles and descriptions on separate lines:

Document image


That completes the first automation. We'll use the default polling schedule, so it will run every 15 minutes 24 hours a day every day.

Now we'll build a second automation that will dump out the articles and email them to us once a day. First select a System Utility trigger:

Document image


Choose the Date Time app:

Document image


Select the "every day at" trigger:

Document image


Configure a time to send the daily email. Here we configure 10pm, based on a 24-hour clock:

Document image


When the automation runs at 10pm, we want to first dump out all the items from the CNBC bucket. Add an action and select the System Utility category:

Document image


Select the Collector app:

Document image


Choose the "dump items from bucket" action:

Document image


This action will emit an array of all the items in the named bucket and delete them from the database. Be sure to configure it with the same bucket name that contains the items:

Document image


Now, the email action expects a single string value for the body of the email, but the Collector action will emit an array. So we need to convert the array to a single string. Also, we want to format the articles with newlines between them.

How did we know to do this? We didn't! We created the automation using a direct mapping from the Collector's dump action to the email body and discovered we didn't like its formatting. Building automations can take some trial and error, plus exploration of the available actions.

We need a data transform:

Document image


Array transforms can be found in the Transform Data app:

Document image


Ah, the first one is what we need:

Document image


We map the emitted item array from the dump bucket action and also add HTML <br/> new lines so the email will have the articles with line breaks between them:

Document image


Next we search for an email action and use this one:

Document image


We enter a suitable subject and map the output from the array formatter to the body:

Document image


That's it! Save the second automation.

At 10pm every day we will get our email containing all CNBC article titles and descriptions for the past 24 hours:

Document image




Updated 28 Nov 2023
Doc contributor
Did this page help you?