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:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/FiTxVKXWe_tpBwlix__Se_image.png?format=webp)
Then use the "collect items into a bucket" to place articles into a named bucket:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/OyGElnHL8bd17XLZTuNPa_image.png?format=webp)
We'll name the bucket "CNBC" and place the article titles and descriptions on separate lines:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/fWnSAEzuH46wi3u-s5yJ8_image.png?format=webp)
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 Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/vMGAc1pHsrbuYtTe30mbs_image.png?format=webp)
Choose the Date Time app:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/CRIq_Kl7PHfJu9Bo7R8Bg_image.png?format=webp)
Select the "every day at" trigger:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/-ZGe-Pmaw8bG_RTPJ-feV_image.png?format=webp)
Configure a time to send the daily email. Here we configure 10pm, based on a 24-hour clock:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/Z_81wx7xJ4qDHnc4TuKPO_image.png?format=webp)
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 Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/yHKGJ5f_OTu0oJ-u8eTg0_image.png?format=webp)
Select the Collector app:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/IzveZxcodXWWtt_K5KkPa_image.png?format=webp)
Choose the "dump items from bucket" action:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/4UtnsE7eeGzE25EcPMbGB_image.png?format=webp)
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 Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/WSFRUWov7EKk31VWYm0rH_image.png?format=webp)
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 Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/7_0zDs20wq-DjfTxkgR-5_image.png?format=webp)
Array transforms can be found in the Transform Data app:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/TsdgfalKOuXLp2jkdwCRR_image.png?format=webp)
Ah, the first one is what we need:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/WkGFJCRgUOtrgYsjrREFf_image.png?format=webp)
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 Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/8wP9lgCEM-y0fh1yg2LI0_image.png?format=webp)
Next we search for an email action and use this one:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/iz_1RfnVR1vKu-KVwe7p3_image.png?format=webp)
We enter a suitable subject and map the output from the array formatter to the body:
![Document image Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/-3JAm66m6-ZHhEquJO-5D_image.png?format=webp)
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 Document image](https://images.archbee.com/Y2QGD8otsIOv4e0hQQnqa/-CVevU9Gq-U2-IJorAqw7_image.png?format=webp)