Checks Apple Store inventory for new MacBook Pro models.
This script's functionality is now available as a macOS app! Read more here: InventoryWatch App by @worthbak
Run npm install
to load the project's dependencies. Assumes recent node
version (tested with v17.0.1
, but should work with earlier versions).
request
for simplifying network requestsnode-notifier
for sending local notifications when stock is detected
First, find the store number of your local Apple Store using the included table (see here for Canadian stores). Then run the script, passing the number as an argument:
$ node index.js R123
This will query Apple's retail inventory for all 2021 MacBook Pro variants that are known to be stocked in-store. R123
is a store in Nashvile, TN, so that store plus others in the surrouding area will be queried. The results are logged to stdout
, and if any models are found, a notification will be sent.
Running the script without a 2nd argument will default to US stores. Adding a second argument specifies the country.
$ node index.js R123 CA
Countries | Argument |
---|---|
United States | US (default) |
Canada | CA |
Australia | AU |
Germany | DE |
United Kingdom | UK |
South Korea* | KR |
Hong Kong | HK |
* These countries do not appear to support in-store pickup, and as such may not work with this tool.
You might want this script to run every minute or so, to make sure you don't miss your desired model coming into stock. To run the script repeatedly, update the following line to match your local environment and add it to crontab
. You will need to update the entry to point to the script directory on your local, your node location (use which node
), and the desired log output file.
*/1 * * * * cd ~/path/to/script/folder/ && /usr/local/bin/node index.js R123 > ~/path/to/desired/log/script_output.log 2>&1
This script checks for most known MacBook Pro variants that are currently stocked by Apple Stores, and has some special logic for my personal favorite model (14" M1 Max 32 Core GPU, 64GB RAM, 2TB SSD in both Silver and Space Gray). You may want to tweak the code if you're not interested in the "Ultimate" models.
For reference, here's how Apple's fulfillment API works.
GET https://www.apple.com/shop/fulfillment-messages
?parts.0=MMQX3LL%2FA // URL encoded part number MMQX3LL/A
&parts.1=MKH53LL%2FA // URL encoded part number MKH53LL/A
&parts.2=MYD92LL%2FA // URL encoded part number MYD92LL/A
...
&searchNearby=true // Instruct the API to search the designated store and the surrounding area
&store=R172 // Store number (R172 is in Boulder, CO)