Hey Makers
![]()
Over here in Europe, the pre-holiday season is hitting hard.
Decorations, Wham, and Mariah Carey on every corner.
People shopping for presents and sipping hot wine in the streets.
What a beautiful and messy time!Looking for something to occupy yourself with while waiting for the holidays?
At Make, we built our own automated Advent calendar!
In our office, we have a snack bar that contains all kinds of treats.
Since a couple of days ago, we also have an Advent Calendar scenario running that assigns a random treat from the snack bar to anyone who types a specific keyword into Slack.
Once you do that - bam - an Advent Bot tells you exactly what you should treat yourself with and makes sure to never offer you the same snack.
- At 8 am, a Slack bot sends an automated message with a countdown till the holidays & a fitting seasonal proverb to our #Advent channel.
- A user comes in to check out the proverb and types in a key phrase “open a window” in order to get a surprise treat.
- A random snack is assigned to the user without any chance of them getting the same item more than once.
- The message that assigns the snack features the user’s name so that it’s clear who should grab what.
- The message also contains an image of the snack so that you know what you’re supposed to be looking for.
What you need
a Slack channel
Integromat app invited into the Slack channel in order to use a bot message
2 data stores (one for snack bar items, one to keep track of snacks that have been assigned to each user)
-
‘New Event’ Slack module listens for all new messages in the channel.
-
A filter checks whether the new messages contain the key phrase (‘open a window’).
-
‘Get a User’ Slack module outputs the full name of the user.
-
Data store checks for all items the user already ate and aggregates them into an array.
-
The array of snacks from the previous step is converted into a string using the function join.
-
The data store outputs all the items and a filter passes only those that are not included in the string thanks to a text operator “does not contain”.
-
All items which passed the filter are aggregated into an array.
-
Functions “get"
general function, “map”, and “shuffle”
array functions select a random item from the aggregated array.
-
Data store is searched for the selected item and outputs additional info saved in the data store (in this case, a link to the picture of the snack)
-
A new record of the user name and the item are created in the second datastore which ensures the user cannot get the same item in the future.
-
A bot message with the username, a random item, and additional info is sent into the channel.