Get weather alerts using ClimaCell Zapier & PushBullet
Tags: weatherapi, tomorrowio, climacell, zapier
Published: 2021-04-07 10:28:48


# Get weather alerts using ClimaCell (Tomorrow.io) Zapier & PushBullet



*Small businesses* around the world are starting to understand the severe impact of weather events on their revenue and on their employee's level of risk. Taking preventive measures is something I started researching for my uncle, who owns a small construction company. 
For example, *strong winds can increase the risk of accidents in a construction site.*

I will show the simplicity of setting up a complete flow that will *trigger push notifications* when the *wind speed is about a certain value* we will define.

For implementing this, we will use [*ClimaCell weather API](http://climacell.co), [Zapier](http://zapier.com), and [PushBullet](http://pushbullet.com).*

Using [ClimaCell](http://climacell.co) API we will be defining an alert that is triggered when some weather condition occurs. 
Then we will connect the hook [Zapier](http://zapier.com) to [PushBullet](http://pushbullet.com) using the [Zapier](http://zapier.com) [ClimaCell](http://climacell.co) integration. PushBullet is installed on my phone and will get the push notification from ClimaCell.

Let's get started,

Create an account in ClimaCell by signing up to an API free account, 
by clicking the “Sign up and start building ” button.
[https://www.climacell.co/weather-api/](https://www.climacell.co/weather-api/)

![](https://cdn-images-1.medium.com/max/7660/1*hFA3DxnEZzqWe02DAjzhqg.png)

![](https://cdn-images-1.medium.com/max/7652/1*2v5V9TFM_VmqzzD51aTHIg.png)

After you signed up you should be inside the ClimaCell app and should be able to view your newly created API key, copy it, and save this key, quite frequently in the following steps.

![](https://cdn-images-1.medium.com/max/7652/1*cTb-7JVAqnCXaQc9Rn_XTQ.png)

Now we need to create a location (for example the construction site location)
we need the coordinates of the location, one way to get those is by using google maps, by searching the location, and right-clicking on the marker.

![](https://cdn-images-1.medium.com/max/4304/1*1-EXNhG5cCoU4wehvO3KQQ.png)

After we got the coordinates lets to make an API call to ClimaCell to create our location:

I will be making the calls from the CLI using curl (*remember to replace the “your_api_key” in the command with your API Key from ClimaCell*)

    curl --request POST \
    --url 'https://data.climacell.co/v4/locations?apikey=<your_api_key>' \
    --header 'Content-Type: application/json' \
    --data '{"name":"Tel Aviv","geometry":{"coordinates":[34.77019,32.05252],"type":"Point"}}'

![using ClimaCell docs playground feature](https://cdn-images-1.medium.com/max/7680/1*3T2i4YvhzG2maVvjtfJ56Q.png)*using ClimaCell docs playground feature*

Copy the Location ID returned in the response.

Now let's create the [Insight](https://www.climacell.co/blog/what-is-a-weather-insight-and-how-can-it-power-your-business-operations/). This is basically the weather condition we define.
Take a look here for a more detailed explanation [https://docs.climacell.co/reference/insights-overview](https://docs.climacell.co/reference/insights-overview)

In our case the *Insight* will look like this:

    "conditions": {
            "type": "OPERATOR",
            "content": {
                "operator": "EQUAL"
            },
            "children": [
                {
                    "type": "PARAMETER",
                    "content": {
                        "parameter": "windSpeed"
                    }
                },
                {
                    "type": "CONST",
                    "content": {
                        "const": 20
                    }
                }
            ]
        }

This insight has one condition, connecting this insight to an alert will trigger the alert when wind speed is above 20 Knots.

    curl --request POST \
    --url 'https://data.climacell.co/v4/insights?apikey=<your_api_key>' \
    --header 'Content-Type: application/json' \
    --data '{"conditions":{"type":"OPERATOR","content":{"operator":"EQUAL"},"children":[{"type":"PARAMETER","content":{"parameter":"windSpeed"}},{"type":"CONST","content":{"const":20}}]},"name":"Windy"}'

*remember to replace the api_key when running this command*

*Copy the Insight ID* returned in the response.

Now we need to create an *Alert* attached to this insight

    curl --request POST \
    --url 'https://data.climacell.co/v4/alerts?apikey=<your_api_key>' \
    --header 'Content-Type: application/json' \
    --data '{"isActive":true,"name":"Strong wind alert","insight":"<the_insight_id>"}'

*remember to replace the api_key and the insight_id in this command with your values*

Now we need to make the connection between the insight and the alert* ([playground](https://docs.climacell.co/reference/post-alerts-id-locations#post-alerts-id-locations-link))

    curl --request POST \
    --url 'https://data.climacell.co/v4/alerts/<alert_id>/locations/link?apikey=<your_api_key>' \
    --header 'Content-Type: application/json' \
    --data '{"locations":["<location_id>"]}'

*remember to replace the api_key and the insight_id and location_id in this command with your values*

After finishing setting up ClimaCell Location, Insight and Alert, and Linking the Alert with the Location we will move into setting up our ClimaCell Zapier integration.

Go to [https://zapier.com/app/editor](https://zapier.com/app/editor), (sign up) and create a new Zap,
search and connect the ClimaCell app into your account and select “New Notification” as the event type.

![](https://cdn-images-1.medium.com/max/7668/1*hlAUtiZFsG_fetuaXfrygA.png)

![](https://cdn-images-1.medium.com/max/7668/1*dY-ry1Bllq0bX-p6eQaE7g.png)

Now we want to set up the Action, lets search and connect to our *PushBullet* account

![](https://cdn-images-1.medium.com/max/3884/1*6s7Oh4asVMmXnFQOhRDK1Q.png)

![](https://cdn-images-1.medium.com/max/3884/1*7katFX2dGsgRy6uCWsJlVg.png)

![](https://cdn-images-1.medium.com/max/7668/1*yhU2lxUtyIRxQyieHpEnLw.png)

Now we need to customize the ClimaCell weather event message, we can use the variables that Zapier and ClimeCell provide

![](https://cdn-images-1.medium.com/max/7668/1*AkC6_mm8hWnG6UYN9HUM7A.png)

![](https://cdn-images-1.medium.com/max/5956/1*rQiQgyb4gPlUDYaPhtoyUg.png)

Clicking one of the Test buttons will send you your *first notification to PushBullet*!

I’m using the PushBullet android app, and it shows up like this:

![](https://cdn-images-1.medium.com/max/2000/1*7SQLLad0rGOODlf4JAFrWQ.png)

![ClimaCell’s development page shows our new Zapier integration enabled](https://cdn-images-1.medium.com/max/7580/1*7QLOyG5JR4isAKdQHLbRgA.png)*ClimaCell’s development page shows our new Zapier integration enabled*

*That’s it*, now every time the condition we set previously in the ClimaCell platform through their API, we will get a notification piped through Zapier, to PushBullet!

![Photo by [Bill Jelen](https://unsplash.com/@billjelen?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)](https://cdn-images-1.medium.com/max/9312/0*2MDnoiEfjEB-RI_E)*Photo by [Bill Jelen](https://unsplash.com/@billjelen?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)*