Collector
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:
Then use the "collect items into a bucket" to place articles into a named bucket:
We'll name the bucket "CNBC" and place the article titles and descriptions on separate lines:
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:
Choose the Date Time app:
Select the "every day at" trigger:
Configure a time to send the daily email. Here we configure 10pm, based on a 24-hour clock:
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:
Select the Collector app:
Choose the "dump items from bucket" action:
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:
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:
Array transforms can be found in the Transform Data app:
Ah, the first one is what we need:
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:
Next we search for an email action and use this one:
We enter a suitable subject and map the output from the array formatter to the body:
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: