iHook

iHook

  • Blog
  • Docs
  • Dashboard

›Task Examples

Quick Start

  • Create your first task
  • Create your first receiver

Task Settings

  • HTTP Settings
  • Request Schedule

Task Notifications

  • Notification Overview
  • Source
  • Property / CSS Selector
  • Comparison
  • Message Template

Task History

  • Chart

Task Errors

  • Errors

Task Shortcuts

  • Keyboard Shortcuts

Receiver Variables

  • Receiver variables

Task Examples

  • Nintendo Switch availability monitor
  • Weather monitor
  • Insider trading monitor
  • Mortgage rate monitor
  • Github repo release monitor

Receiver Examples

  • Create an Okta Hook receiver
  • Create a SendGrid Event Webhook receiver

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:

General Settings

Under the Request Settings and Request Schedule sections, provide the following values:

FieldValueNotes
Task NameNintendo Switch monitor - TargetThe name of the task
URLhttps://redsky.target.com/v3/pdp/tcin/77464002?excludes=taxonomy&key=eb2551e4accc14f38cc42d32fbc2b2eaTarget.com API that returns Nintendo Switch availability
Request MethodGET
Request HeadersNoneNo headers are needed
Request ScheduleEvery 1 dayThe 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:

target api

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:

add-notification

Then a notification setup dialog will show up:

email notification

Then provide the following values in the dialog:

FieldValueNotes
SourceResponse Body (JSON)Parse the API response as JSON payload
Propertyproduct.available_to_promise_network.online_available_to_promise_quantityThe property path for online availability information in JSON response
Comparisongreater than (number)
Target Value0This tells iHook that whenever the property is greater than 0, an email notification will be sent
EmailYour email address
SubjectSwitch is available!The email subject
MessageNintendo 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:

saved-notification

3. Save task

Click the CREATE button at the bottom of the task creation page:

create-task-button

Now you'll see the created task in ACTIVE state:

created task

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:

edit-notification-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:

history

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:

history

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!

← Receiver variablesWeather monitor →
  • 1. Setup HTTP request
  • 2. Create email notification
  • 3. Save task
  • 4. Test task
  • 5. Sit and wait
Copyright © 2024 iHook, Inc.