How-tos

Smart, Serverless, Slack: Automated Weekly Reports

Share this post:

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

Architecture – Traffic Analytics

Overview

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

GitHub Traffic Bot on Slack

Summary

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.

Technical Offering Manager / Developer Advocate

More How-tos stories
April 11, 2019

How to Automate TLS Certificate Rotation to Avoid Outages

In this post, we'll share how you can make sure you have end-to-end protection for data in transit without running into any TLS certificate expiry issues.

Continue reading

April 5, 2019

Node.js 502 Bad Gateway Issues and How To Resolve Them

In December of 2018, many Node.js users noticed that their applications randomly returned an HTTP status code 502 "Bad Gateway" error. In this post, we'll show you how to resolve this issue if you have been affected.

Continue reading

April 3, 2019

Managing IBM Cloud Resources with a Service ID Through the Command Line Interface

We are excited to announce that you can now log into IBM Cloud with a service ID in v0.15.0 of the IBM Cloud CLI. This enables users to manage IBM Cloud resources with a service ID created within an account through the command line interface.

Continue reading