Last active
December 17, 2015 02:19
-
-
Save mbmccormick/5534903 to your computer and use it in GitHub Desktop.
Webscript for tracking the stock status of a product at Best Buy. When scheduled as a cron job, this will send a text message when an item becomes available nearby.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local sku = '8390054' | |
local zipcode = '10001' | |
local response = http.request { | |
url = 'http://api.remix.bestbuy.com/v1/stores(area(' .. zipcode .. ',15))+products(sku=' .. sku .. ')?format=json&apiKey=YOUR_API_KEY' | |
} | |
local data = json.parse(response.content) | |
if #data.stores > 0 then | |
log('SKU ' .. sku .. ' is available at ' .. #data.stores .. ' Best Buy location(s) in the area.') | |
alert.sms('The product that you are tracking is now available at ' .. #data.stores .. ' Best Buy location(s) in the area.') | |
else | |
log('SKU ' .. sku .. ' is not available at any Best Buy location in the area.') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment