# Alert plugin (opens new window)

Alerts are user-defined conditions automatically and continuously evaluated on streamed probe results as new forecast data are gathered. It can be viewed as an automated query of the Probe results API that will raise an event whenever a matching result is found. With alert you can create triggers which will fire on an occurrence of the selected weather conditions (temperature, humidity, pressure, etc.) in a specified period of time and area.

# Alerts API

TIP

On the client/server side the API is exposed using the Feathers isomorphic API (opens new window)and the Feathers common database query API (opens new window)

The plugin exposes the available probes through the alerts service. Although only web sockets are usually used on the client side, both the REST (opens new window) and the Socket (opens new window) interfaces are configured.

WARNING

update, patch methods are not allowed on alerts for now, you will have to recreate an alert to update it.

# Data model

The common data model of an alert as used by the API is detailed here.

# Create an alert

Coming soon !

# Remove an alert

Coming soon !

# Alert hooks

The following hooks are executed on the alert service.

# .marshallAlert(hook) source (opens new window)

Convert from server side types (moment dates) to basic JS types when "writing" to DB adapters. Because conditions contains Mongo reserved keywords they will be serialized as well.

# .unmarshallAlert(hook) source (opens new window)

Convert back to server side types (moment dates) from basic JS types when "reading" from DB adapters. Will unserialize conditions as well.