Star Slacker: Posting Play Store reviews to Slack
In our mobile team at YPlan, we love using Slack for all sorts of notifications.
We get notifications for code reviews, build status (read more about our iOS CI pipeline here), crashes and finally for user reviews! Well, at least iOS user reviews. That's easy, we get them for free from LaunchKit, but unfortunately not so lucky with Play Store reviews. There are some paid solutions out there that will solve this for a monthly fee, but we decided that this is worth spending a Friday afternoon and just sort it out ourselves. Our script for doing this is on Github and this blog post will explain how it all works.
How do I get the reviews?
The Play Store automatically creates a Google Cloud Storage bucket for you. It's a bit hidden, but here's how to find it. Go to your Developer Console, then to the Reports section. Now go to Reviews and select any of your apps (as far as I know there is only one bucket for all the apps). Under "Direct report URIs" you will find something that looks like this:
That's the direct URI to your reviews bucket. To access the contents from that URI, follow the instructions here.
If you only want to run locally,
gsutil is the easiest way to go, but if you want to deploy this somewhere, you will need to create and give access to a service account.
Note: in addition to the steps described above, in order to be able to download reviews with the service account, we also had to turn on the Google Cloud Storage JSON API in our Google Cloud Console.
How do I post to Slack?
This part is much easier, all you need to do is to create a Slackbot and make note of the token.
Ok, now what does this script actually do?
Once you've setup your settings and secrets, according to the setup instructions, the script downloads the report for the current month, looks for any reviews or ratings in the last day (or how many you defined) and posts these to Slack. That's it!
And you run this everyday?
Yes! But not manually of course. We've deployed it as an AWS Lambda Function that runs daily, but we'll talk more about how we did that in the next blog post.