A bit of a hack, but we want to be notified if an item becomes available at IKEA.
This is just a shell script that should work on any *NIX that has curl installed.
This is how their API response looks like (replace th with your country code): https://www.ikea.com/th/en/iows/catalog/availability/S99067497
There are only two stores in Thailand, both of which are close enough to the Oozou office, we only care that it's available in one of those stores.
#!/usr/bin/env bash
url="https://www.ikea.com/th/en/iows/catalog/availability/$1"
# This is the string that we want to see changed
string="0"
while true; do
# Get the API response and return as string
text=$(curl -s "$url")
# Get a count of how many times the substring matches
count=`grep -o "$string" <<< "$text" | wc -l`
# If less than 2, then it's available!
if (( $count < 2 )); then
echo "AVAILABLE, yay.";
# Notify us via Slack
curl -X POST --data-urlencode "payload={\"channel\": \"…\", \"username\": \"ikea\", \"text\": \"Item $1 is now available at IKEA.\", \"icon_emoji\": \":shooping_bags:\"}" https://hooks.slack.com/services/…
break
else
# If not available, sleep for 30s
echo "$1 not in stock"
sleep 30
fi
done
Pass in your item ID to start:
$ ./check.sh S99067497
From us to your inbox weekly.