One of my colleagues reached out to me to see if I can help automate a weekly status update task using Serverless and Slack bots. He currently has to download an excel file from a server every Monday at 9AM and provide stats to the team based on the contents of the file. This is a perfect opportunity to use periodic triggers and serverless actions to automate this mundane task ! I am using Apache OpenWhisk hosted on IBM Cloud Functions, but you can easily follow this same recipe on other serverless platforms.
The code is divided into two functions / actions
- read-cos : reads the file from IBM Cloud Object Store and aggregates the stats that need to be shared with the team
- post-slack : posts a message to a given channel on Slack
I finally create a sequence action composed of the above two actions. I then link a trigger that invokes this sequence every Monday at 9am ! Easy peasy !
The application uses the following solutions
- IBM Cloud Storage to store the excel file
- IBM Cloud Functions as the hosted version of Apache OpenWhisk to store our actions/functions
- OpenWhisk CLI (WSK) to create and test actions from the terminal
- Slack API
The complete source is available on Github. Additionally, I have recorded a video that goes through the process. Take a look …
What are your automation stories with Serverless ? Please share in the comments below !
Thought of the day …
Top comments (0)