This is One Way to Never Miss a Sale
In the spirit of the holidays, and the shopping opportunities that go along with it; we have a nifty way to never miss an online sale. How about a little shopping helper that texts you when the item you have been looking for goes on sale? This should help you accumulate some brownie points with your wife at least. Using our SMS API and Topshelf we’ll build a little service to help you hunt for those deals.
It All Started with a “Box of… What”?
By now you should have heard of the famous “BOC” that people rush to buy, in hopes that a plasma TV or other much better surprise comes in it. Most of the time, it truly is a box of crappy items, but the hopes of many have made this somewhat of a boxed unicorn. This box of crap and the multitude of ways others have created alert systems for sales was the inspiration for this little project.
I decided to find a way to alert me of new items that came on sale. In order to do this I needed 4 things: a source, a parsing mechanism, an alerting mechanism, and lastly a way to execute this at set time intervals.
The easiest way to look for information is to piggyback on readily available RSS feeds that contain the latest items on sale. Just look for this orange icon and copy its URL.
Parsing is the exercise of analyzing a series of symbols; in our case we will be looking for keywords like “box of crap” or “Oculus Rift” perhaps. There are several ways to do this; a simple web search will provide results that will show you how, even asynchronously. I won’t go into details but you have options.
This should be familiar to many, text messages can be sent using our RESTful API. Here is a quick example sans the phone number and OAuth token.
I am sending the name and URL to buy the item we searched for, this way I can save time and buy the item quickly from my phone.
Execution and Automation
Lastly, we need a way to execute the search and alert functionality every X amount of time and without our interaction. Here is where Topshelf comes into play, it makes it easy to turn programs into services and it even runs in Mono so it’s compatible with other OS’.
Install the nuget package (nuget Install-Package Topshelf) and configure the service as follows.
Now you can install this service on your machine and as long as it is running it will be searching for your deals and texting you when the hunt is over.
A few notes for clarity, make sure you set a reasonable interval; you don’t want to be checking for deals each second or sending texts every second. Set a maximum amount of texts per item found, you can always use the Get SMS Delivery API call to verify the message was received.
Let us know what deals you are hunting in the comments and Happy Holidays to all.