Nintendo Switch availability monitor
Nintendo Switch is a very popular game console and people often find it out of stock in online stores. In this tutorial, we'll use iHook to monitor Nintendo Switch availability on Target.com, and receive an email notification when it is in stock.
1. Setup HTTP request
After logging into iHook dashboard, click the CREATE TASK
button at the top left corner, then you will see the task creation form:
Under the Request Settings
and Request Schedule
sections, provide the following values:
Field | Value | Notes |
---|---|---|
Task Name | Nintendo Switch monitor - Target | The name of the task |
URL | https://redsky.target.com/v3/pdp/tcin/77464002?excludes=taxonomy&key=eb2551e4accc14f38cc42d32fbc2b2ea | Target.com API that returns Nintendo Switch availability |
Request Method | GET | |
Request Headers | None | No headers are needed |
Request Schedule | Every 1 day | The task will run once every day |
This tells the task to issue a GET
request to the Target.com API endpoint once every day for Nintendo Switch availability information.
2. Create email notification
The Target API returns the following data in JSON format, which you can check by visiting the Target Nintendo Switch website and inspecting your browser's network traffic in the developer console:
Let us set up a notification condition around the API response's online availability property, so we can get notified when Switch is in stock. Under the Notification
section, click the ADD
button next to the Email
label:
Then a notification setup dialog will show up:
Then provide the following values in the dialog:
Field | Value | Notes |
---|---|---|
Source | Response Body (JSON) | Parse the API response as JSON payload |
Property | product.available_to_promise_network.online_available_to_promise_quantity | The property path for online availability information in JSON response |
Comparison | greater than (number) | |
Target Value | 0 | This tells iHook that whenever the property is greater than 0, an email notification will be sent |
Your email address | ||
Subject | Switch is available! | The email subject |
Message | Nintendo Switch is available! Go to https://www.target.com/p/nintendo-switch-with-gray-joy-con/-/A-77464002 and order one! | The email body |
This tells iHook to send an email notification whenever the Target API response body's online_available_to_promise_quantity
property value is greater than 0
.
Click SAVE
, you will see the new email notification appear under the Notification
section:
3. Save task
Click the CREATE
button at the bottom of the task creation page:
Now you'll see the created task in ACTIVE
state:
4. Test task
To make sure your task settings such as URL and notification rules are properly configured, it's recommended to test your task at least once by clicking the TEST
button at the top of your task page. The TEST
button will trigger the HTTP request right away, and evaluate all configured notification conditions.
Let us pick a stock quantity that is lower than the current value for testing purposes, say -1
. Under your newly created task, modify the email notification by clicking the edit button:
Change the Target Value
field from 0
to -1
, then click SAVE
. Now, our task should be able to send out an email notification when Switch quantity is greater than -1. Let us see that in action. Now click TEST
at page top, the task page will switch to the History
tab, where we can check the task status. Within a couple of seconds, you should see the execution status turn into COMPLETED
:
At this point, you should receive an email triggered by the task.
If things didn't work as expected, this could happen due to a misconfigured notification condition such as an invalid JSON property path, or due to a temporary network connectivity issue. You may want to check the errors
section under your execution detail for a hint:
Once verified everything is working as expected, you can revert the email notification condition by changing the Target Value
back to 0, and then click SAVE
.
5. Sit and wait
Congratulations! You can now sit back and wait for the iHook email notification whenever Nintendo Switch is in stock on Target.com!