Smart, Serverless, Slack: Automated Weekly Reports

By: Henrik Loeser

Serverless actions save time and resources

The code for the GitHub traffic statistics has been extended by automated weekly reports that are posted to Slack. It shows how serverless actions save time and resources. In this case, an IBM Cloud Function creates a report from a Db2 database and then posts it into a Slack channel. A few seconds of serverless actions save minutes of manual work.

Architecture - Traffic Analytics


In an earlier blog post, I introduced you to an IBM Cloud solution tutorial for automatic retrieval and analytics of GitHub traffic data. GitHub offers traffic statistics for the code repositories. They provide insights into traffic sources, number of views, and clones. Unfortunately, only the data for the most recent 14 days are available. Using the cloud solution, a serverless actions automatically retrieves the data and stores it in Db2 Warehouse on Cloud. There, it can be reviewed and analyzed across repositories and over time.

I am interested in the GitHub traffic data because I write and publish code, share material related to my talks, and publish code snippets for my blog posts. Up to this point, I manually pulled the reports when I had time. Enter the new code and the resulting time saved.

Automated Slack messages

I extended the existing solution by a new IBM Cloud Functions action. That function pulls data from Db2 and composes a report. Thereafter, that action publishes the report as a new message to my team’s Slack channel. Slack supports incoming webhooks that allow an easy, quick, and secure way for external services to publish messages. The report is kicked off by an IBM Cloud Functions alarm. It triggers the execution once a week when all statistics for the previous week are available. A few seconds later, my team sees something like the following: 

GitHub Traffic Bot on Slack


To get an overview of this solution and to get ideas for utilizing serverless actions for smart solutions, check out these resources:

If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik) or LinkedIn.


More How-tos stories

Be the first to hear about news, product updates, and innovation from IBM Cloud