Use Cases

Products

Developer

Blog

Blog

/

Product

Real-time weather alerting with webhooks

2.2.2024//Product, Educational, Webhooks, API & Mapping

Blog post banner

Lee Huffman

Chief Technology Officer, AerisWeather

Note: This post highlights webhook alerting for severe weather events for facilities management; however, Xweather supports the delivery of numerous datasets via webhook. Reach out to our team to schedule a demonstration tailored to your specific industry or use case.

When it comes to ensuring the safety of your employees, facilities, and the public, it is paramount to have near real-time access to accurate weather information - including weather alerts.

The Xweather API provides quick access to this weather information via the alerts endpoint. This data includes critical government-issued weather advisories, watches, and warnings from the likes of National Weather Service in the US, Environment Canada in Canada, MeteoAlarm in the EU, and the UK Met Office for the UK. You can obtain this information by querying the API for a specific location. For example, you may query the alerts endpoint to get current alerts for Minneapolis:

Querying every one to two minutes to obtain the latest active alerts is sufficient in non-emergency situations for just a few locations. However, most will require faster notification - especially where multiple locations are involved - or in the instance high-impact and short-fuse warnings, like for tornado. During a tornado warning, seconds matter to ensure the safety of your employees, clients, and assets.

These scenarios are where Xweather's webhooks excel. With alert webhooks, you will receive real-time alerts within seconds of issuance and receipt from the respective government agencies.

What are webhooks?

A webhook, also known as an HTTP callback, is a lightweight API that allows for information to be pushed based on trigger events. When using the Xweather API, you are pulling information via API requests; whereas with webhooks, we push information directly to you, allowing you to act upon the information quickly and efficiently.

In practice, you provide Xweather with one or more URLs to a lightweight API that you host. We will then push data to your URL when specific events are triggered. Events that might trigger a data push include new alerts being received, updates to existing alerts, or an alert cancelation. Other webhook datasets may be triggered by other events.

When an event is triggered, Xweather will perform an HTTPS POST to the URLs you have provided. For ease of implementation, the HTTP body included in the webhook POST will be a JSON object and match the standard Xweather API output for that endpoint. This implementation allows clients to efficiently migrate from the API to webhooks as their usage grows. Additionally, we offer several security options to ensure you only receive valid updates from Xweather for enhanced protection.

Which weather data can be a webhook?

The most common use case for webhooks is weather alerting, including government-issued warnings, watches, and advisories within the US, Canada, and Europe - but there are plenty more datasets to choose from. Most of Xweather's datasets support webhooks.

Popular webhook-compatible datasets

DatasetDescription
AlertsGovernment-issued alerts, including warnings, watches, and advisories. Currently available for the USA, Canada, and Europe regions.
LightningLightning strike information. Available globally.
Tropical cyclonesActive tropical cyclones, including hurricanes, tropical storms, and typhoons. Includes current locations, wind speeds, pressure, forecast path, error cone, and associated wind fields. Available globally.
FiresActive wildfires within the USA and Canada, including fire perimeters when available.
EarthquakesGlobal earthquakes, including location, magnitude, and depth.
OtherMost of our datasets are available via webhooks. Contact us for more information.

Alert webhooks

We already discussed the use case of using alert webhooks to ensure receipt of short-fuse alerts as soon as possible, such as tornado warnings. With a Webhooks implementation, you will receive these warnings within seconds of issuance and receipt from the respective government organization.

Another use case for webhooks is when you need to monitor hundreds, thousands, or even millions of locations for employees, clients, facilities, mobile users, or other assets. While you could query the Xweather API for each location, the volume of queries would quickly add up. Additionally, the infrastructure and management costs to query the API thousands of times concurrently can quickly become non-trivial, especially as your service grows.

With alert webhooks, alerts are pushed to a web service of your choice. The alert format will include the polygon of the alert coverage area. With this information, your web service can then query your local database for locations within the alert area, and then perform any notifications or other tasks only on the affected locations. This method allows you to act only on locations affected by an alert versus querying the API millions of times per day to monitor each location individually.

As detailed above, you can receive weather alerts in real-time for only monitored locations within the affected area. This combination improves monitoring while lowering costs by removing the need to continuously query the alerts endpoint for each location.

Enhanced alert webhook filtering

Alert webhooks will send all government-issued weather alerts supported within the Xweather alerts endpoint. These alerts will include their coverage area polygons, which allow filtering to just your monitored locations affected by the alert.   

Restricting actions based on the alert's coverage area is beneficial. However, you may want to filter actions based on the alert type instead. For example, your use case may only require notifying clients if they are affected by tornado, severe thunderstorm, or flash flood warnings. For this use case, you can filter on the alert type code. This code is available within the JSON object sent in the webhook's body. Specifically, look for the response[#].details.type, as seen in the snippet below:

The alert's type code will match one of the alert codes listed within the alert types documentation. With our use case example, to filter the incoming webhooks to just tornado, severe thunderstorm, and flash flood warnings, you would step through the response array, checking the details.type to see if it matches either TO.W, SV.W, or FF.W.

Implementing localized alert type filtering allows you to limit actions to the specific alerts needed while quickly and easily adjusting the alert filtering as your needs evolve.

Next steps

Webhooks are a powerful tool to help monitor how severe weather may affect employees, clients, facilities, and other assets, while also helping to control costs. Reach out today to learn more.

Lee Huffman

Chief Technology Officer, AerisWeather

Related Resources

Related
Resources

Resource

Weather API

Client Stories

TÜV SÜD brings weather into risk consulting solutions

Previous

How technology pushes us into a new era of weather prediction

=

Next

Animating weather map layers with Mapbox GL