<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aviv Shafir</title>
    <description>The latest articles on DEV Community by Aviv Shafir (@avivshafir).</description>
    <link>https://dev.to/avivshafir</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F371716%2F947abd66-2ed2-4009-80bb-4604298faa08.jpeg</url>
      <title>DEV Community: Aviv Shafir</title>
      <link>https://dev.to/avivshafir</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/avivshafir"/>
    <language>en</language>
    <item>
      <title>Get weather alerts using ClimaCell Zapier &amp; PushBullet</title>
      <dc:creator>Aviv Shafir</dc:creator>
      <pubDate>Wed, 07 Apr 2021 10:28:48 +0000</pubDate>
      <link>https://dev.to/avivshafir/get-weather-alerts-using-climacell-zapier-pushbullet-bmj</link>
      <guid>https://dev.to/avivshafir/get-weather-alerts-using-climacell-zapier-pushbullet-bmj</guid>
      <description>&lt;h1&gt;
  
  
  Get weather alerts using ClimaCell (Tomorrow.io) Zapier &amp;amp; PushBullet
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Small businesses&lt;/em&gt; 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. &lt;br&gt;
For example, &lt;em&gt;strong winds can increase the risk of accidents in a construction site.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I will show the simplicity of setting up a complete flow that will &lt;em&gt;trigger push notifications&lt;/em&gt; when the &lt;em&gt;wind speed is about a certain value&lt;/em&gt; we will define.&lt;/p&gt;

&lt;p&gt;For implementing this, we will use &lt;a href="http://climacell.co"&gt;*ClimaCell weather API&lt;/a&gt;, &lt;a href="http://zapier.com"&gt;Zapier&lt;/a&gt;, and &lt;a href="http://pushbullet.com"&gt;PushBullet&lt;/a&gt;.*&lt;/p&gt;

&lt;p&gt;Using &lt;a href="http://climacell.co"&gt;ClimaCell&lt;/a&gt; API we will be defining an alert that is triggered when some weather condition occurs. &lt;br&gt;
Then we will connect the hook &lt;a href="http://zapier.com"&gt;Zapier&lt;/a&gt; to &lt;a href="http://pushbullet.com"&gt;PushBullet&lt;/a&gt; using the &lt;a href="http://zapier.com"&gt;Zapier&lt;/a&gt; &lt;a href="http://climacell.co"&gt;ClimaCell&lt;/a&gt; integration. PushBullet is installed on my phone and will get the push notification from ClimaCell.&lt;/p&gt;

&lt;p&gt;Let's get started,&lt;/p&gt;

&lt;p&gt;Create an account in ClimaCell by signing up to an API free account, &lt;br&gt;
by clicking the “Sign up and start building ” button.&lt;br&gt;
&lt;a href="https://www.climacell.co/weather-api/"&gt;https://www.climacell.co/weather-api/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8KCaGsYn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7660/1%2AhFA3DxnEZzqWe02DAjzhqg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8KCaGsYn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7660/1%2AhFA3DxnEZzqWe02DAjzhqg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--08faQL-u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7652/1%2A2v5V9TFM_VmqzzD51aTHIg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--08faQL-u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7652/1%2A2v5V9TFM_VmqzzD51aTHIg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ebk3H-uX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7652/1%2AcTb-7JVAqnCXaQc9Rn_XTQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ebk3H-uX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7652/1%2AcTb-7JVAqnCXaQc9Rn_XTQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we need to create a location (for example the construction site location)&lt;br&gt;
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.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--11I83ehy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/4304/1%2A1-EXNhG5cCoU4wehvO3KQQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--11I83ehy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/4304/1%2A1-EXNhG5cCoU4wehvO3KQQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After we got the coordinates lets to make an API call to ClimaCell to create our location:&lt;/p&gt;

&lt;p&gt;I will be making the calls from the CLI using curl (&lt;em&gt;remember to replace the “your_api_key” in the command with your API Key from ClimaCell&lt;/em&gt;)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --request POST \
--url 'https://data.climacell.co/v4/locations?apikey=&amp;lt;your_api_key&amp;gt;' \
--header 'Content-Type: application/json' \
--data '{"name":"Tel Aviv","geometry":{"coordinates":[34.77019,32.05252],"type":"Point"}}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iOxtUpdo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7680/1%2A3T2i4YvhzG2maVvjtfJ56Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iOxtUpdo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7680/1%2A3T2i4YvhzG2maVvjtfJ56Q.png" alt="using ClimaCell docs playground feature"&gt;&lt;/a&gt;&lt;em&gt;using ClimaCell docs playground feature&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Copy the Location ID returned in the response.&lt;/p&gt;

&lt;p&gt;Now let's create the &lt;a href="https://www.climacell.co/blog/what-is-a-weather-insight-and-how-can-it-power-your-business-operations/"&gt;Insight&lt;/a&gt;. This is basically the weather condition we define.&lt;br&gt;
Take a look here for a more detailed explanation &lt;a href="https://docs.climacell.co/reference/insights-overview"&gt;https://docs.climacell.co/reference/insights-overview&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In our case the &lt;em&gt;Insight&lt;/em&gt; will look like this:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"conditions": {
        "type": "OPERATOR",
        "content": {
            "operator": "EQUAL"
        },
        "children": [
            {
                "type": "PARAMETER",
                "content": {
                    "parameter": "windSpeed"
                }
            },
            {
                "type": "CONST",
                "content": {
                    "const": 20
                }
            }
        ]
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This insight has one condition, connecting this insight to an alert will trigger the alert when wind speed is above 20 Knots.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --request POST \
--url 'https://data.climacell.co/v4/insights?apikey=&amp;lt;your_api_key&amp;gt;' \
--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"}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;remember to replace the api_key when running this command&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Copy the Insight ID&lt;/em&gt; returned in the response.&lt;/p&gt;

&lt;p&gt;Now we need to create an &lt;em&gt;Alert&lt;/em&gt; attached to this insight&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --request POST \
--url 'https://data.climacell.co/v4/alerts?apikey=&amp;lt;your_api_key&amp;gt;' \
--header 'Content-Type: application/json' \
--data '{"isActive":true,"name":"Strong wind alert","insight":"&amp;lt;the_insight_id&amp;gt;"}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;remember to replace the api_key and the insight_id in this command with your values&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now we need to make the connection between the insight and the alert* (&lt;a href="https://docs.climacell.co/reference/post-alerts-id-locations#post-alerts-id-locations-link"&gt;playground&lt;/a&gt;)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --request POST \
--url 'https://data.climacell.co/v4/alerts/&amp;lt;alert_id&amp;gt;/locations/link?apikey=&amp;lt;your_api_key&amp;gt;' \
--header 'Content-Type: application/json' \
--data '{"locations":["&amp;lt;location_id&amp;gt;"]}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;remember to replace the api_key and the insight_id and location_id in this command with your values&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Go to &lt;a href="https://zapier.com/app/editor"&gt;https://zapier.com/app/editor&lt;/a&gt;, (sign up) and create a new Zap,&lt;br&gt;
search and connect the ClimaCell app into your account and select “New Notification” as the event type.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gScnuZ63--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7668/1%2AhlAUtiZFsG_fetuaXfrygA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gScnuZ63--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7668/1%2AhlAUtiZFsG_fetuaXfrygA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pEchcocu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7668/1%2AdY-ry1Bllq0bX-p6eQaE7g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pEchcocu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7668/1%2AdY-ry1Bllq0bX-p6eQaE7g.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we want to set up the Action, lets search and connect to our &lt;em&gt;PushBullet&lt;/em&gt; account&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WINOfbHw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3884/1%2A6s7Oh4asVMmXnFQOhRDK1Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WINOfbHw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3884/1%2A6s7Oh4asVMmXnFQOhRDK1Q.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5tOoJBR---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3884/1%2A7katFX2dGsgRy6uCWsJlVg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5tOoJBR---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3884/1%2A7katFX2dGsgRy6uCWsJlVg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dJ2MAME1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7668/1%2AyhU2lxUtyIRxQyieHpEnLw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dJ2MAME1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7668/1%2AyhU2lxUtyIRxQyieHpEnLw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we need to customize the ClimaCell weather event message, we can use the variables that Zapier and ClimeCell provide&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eRI2qd8n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7668/1%2AAkC6_mm8hWnG6UYN9HUM7A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eRI2qd8n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7668/1%2AAkC6_mm8hWnG6UYN9HUM7A.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AACuNSYk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/5956/1%2ArQiQgyb4gPlUDYaPhtoyUg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AACuNSYk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/5956/1%2ArQiQgyb4gPlUDYaPhtoyUg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clicking one of the Test buttons will send you your &lt;em&gt;first notification to PushBullet&lt;/em&gt;!&lt;/p&gt;

&lt;p&gt;I’m using the PushBullet android app, and it shows up like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q_HFpIKz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A7SQLLad0rGOODlf4JAFrWQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q_HFpIKz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A7SQLLad0rGOODlf4JAFrWQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R0UJ6610--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7580/1%2A7QLOyG5JR4isAKdQHLbRgA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R0UJ6610--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/7580/1%2A7QLOyG5JR4isAKdQHLbRgA.png" alt="ClimaCell’s development page shows our new Zapier integration enabled"&gt;&lt;/a&gt;&lt;em&gt;ClimaCell’s development page shows our new Zapier integration enabled&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;That’s it&lt;/em&gt;, 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!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hl01XTMU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/9312/0%2A2MDnoiEfjEB-RI_E" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hl01XTMU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/9312/0%2A2MDnoiEfjEB-RI_E" alt="Photo by [Bill Jelen](https://unsplash.com/@billjelen?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)"&gt;&lt;/a&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@billjelen?utm_source=medium&amp;amp;utm_medium=referral"&gt;Bill Jelen&lt;/a&gt; on &lt;a href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>weatherapi</category>
      <category>tomorrowio</category>
      <category>climacell</category>
      <category>zapier</category>
    </item>
  </channel>
</rss>
