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

Weather monitor

You can use iHook to monitor the weather forecast data by consuming the OpenWeather API. In this example, we'll create an iHook task that sends you an email notification when it's going to rain.

1. Create a free OpenWeather account

First, register a new OpenWeather account here. The API key will be sent to you in a confirmation email. You'll need this API key to call the OpenWeather API. You may also find your API keys under the account page.

2. Create an iHook scheduled task

After logging into the 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 NameWeather monitorThe name of the task
URLhttps://api.openweathermap.org/data/2.5/onecall?lat=YOUR_LATITUDE&lon=YOUR_LONGITUDE&units=imperial&exclude=current,minutely&appid=YOUR_API_KEYOpenWeather API that returns weather forecast for the upcoming days. lat, lon, and appid are three required parameters. More details see here.
Request MethodGET
Request HeadersNoneNo headers are needed
Request ScheduleEvery 1 dayThe task will run once every day

This task fetches the weather forecast data from the OpenWeather server once every day.

3. Create email notification

The API response body carries the weather forecast data in JSON format. Next let us set up an email notification so we can get notified when it's going to rain. In this case, we will check the weather object under the daily section in the response body.

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
JSON pathdaily[1].weather[0].mainJSON path of the weather property for tomorrow
Comparisonequals (string)
Target valueRain
EmailYour email address
SubjectIt's going to rain tomorrow, postpone lawn watering :) yay!The email subject
MessageYou can leave this field as-isThe email body

This tells iHook to send an email notification when the OpenWeather forecast data indicates that it's going to rain tomorrow.

Now click SAVE, you will see the new email notification appear under the Notification section.

4. Save task

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

create-task-button

You'll see the created task in ACTIVE state.

5. 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.

You can perform the test 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.

If everything went smooth, you should see the weather data appear in the Response Body section of the execution detail:

history

Under the Notification Status section of the execution history page, you can check the conditionEvaluatedResult to make sure the JSON path is evaluated properly.

notification-status

Congratulations! You can now sit back and wait for the iHook email notification when it's going to rain.

← Nintendo Switch availability monitorInsider trading monitor →
  • 1. Create a free OpenWeather account
  • 2. Create an iHook scheduled task
  • 3. Create email notification
  • 4. Save task
  • 5. Test task
Copyright © 2024 iHook, Inc.