One of the best ways to encourage people to download your Windows Phone app is through positive reviews. But only people browsing in the app store are going to see those right? Well what if there was a way you could share with your Twitter followers every time you got a new 5-star review? Or what if you wanted to be notified if you received a 1 or 2-star review so you could contact the reviewer through the developer portal?
If you are an active Twitter user you may already be familiar with IFTTT (If This Then That) or other similar services such as dlvr.it. These services allow you to create some basic scenarios where if something happens, then do this. A common example would be if there is a new item on an RSS feed, make a post about it on my twitter account.
You can probably see where I’m going here, right? Just find an RSS feed with reviews for my app and I can setup IFTTT to tweet every time I get a 5-star review. Easy enough. So where is that RSS feed…?
Well it is easy enough to build with ASP.net web API, HTML Agility Pack and Azure Web Sites. I’ll talk a little about the code, but won’t do a deep dive. You can download the full source from GitHub.
All there is basically is a web API project. I added a ReviewModel class, a Reviews controller which handles the web API calls and contains the logic for scraping reviews from the store page, and a SyndicationFeedFormatter class that takes a collection of reviews and creates the RSS feed content.
The real heavy lifting is in the ReviewsController scraping the reviews from the Windows Phone store app page, but even that is made easier thanks to the HTML Agility Pack which parses HTML documents into a straightforward, easy-to-use DOM. What also helps is when the html is nice and clean with unique IDs or other attributes that can be used to identify the elements you are trying to pull data out of. Below is a portion of the HTML containing reviews:
The only thing you should have to edit in the web project is the appSetting called WhitelistAppIds. Populate this value with a comma-separated list of application IDs that you want to allow to be served up. This will prevent others from leeching off of your web deployment to get reviews for their apps.
You can deploy the website to any web host that supports ASP.net MVC and Web API, but I chose to host my site on Microsoft Azure. Microsoft Azure provides you with 10 free websites and the integration with Visual Studio is terrific.
So once the website is deployed, you just need to access /api/Reviews/MyAppId where MyAppId is your Application ID to get an RSS feed. The default feed will return only 5-star reviews. You can add querystring parameters for minimumReviewValue and maximumReviewValue to further refine the feed. For example, accessing /api/Reviews/MyAppId?minimumReviewValue=4&maximumReviewValue=5 would return 4 and 5-star reviews.
Once you have an RSS feed setup you can now setup a new “recipe” at IFTTT. When you create a new recipe, you choose a “this” and a “that”. Your this is going to be from the Feed
channel. You then have the option of choosing whether you want your action to be kicked off from a new feed item or an item that matches a certain keyword or phrase. I selected new feed item. Supply the address for the RSS feed when prompted and click “Create Trigger”.
For your “that” select Twitter. If this is your first time using the Twitter action, you may be prompted to activate the Twitter channel which is just authorizing IFTTT to access your account as you would for any other 3rd party Twitter app. You will then be presented with a number of Twitter actions. Click “Post a tweet”, and you should see the following:
The default message includes the Title and URL from the RSS feed. By default, the title will be “Another n-Star Review!” where n is the number of stars from the review. You can modify this easily in the SyndicationFeedFormatter class. The URL will be your apps Windows Phone store page. You may want to customize this text with your apps name or a hashtag as well. When you are done just click “Create Action” and you’re done.
As I mentioned earlier, you could also setup a recipe to be informed of 1 or 2-star reviews that you may want to look at and respond to through the developer portal. When you create an IFTTT recipe to do so, just select Email as your “that” and set it up accordingly.