Weather Notification App using IBM Insights for Weather, Node-RED and Twilio in IBM Bluemix

 

IBM® Bluemix™ is the Platform as a Service(PaaS) cloud offering from IBM®. It enables organizations and developers to quickly and easily create, deploy, and manage applications on the cloud. Bluemix delivers enterprise-level services that can easily integrate with your cloud applications without you needing to know how to install or configure them. Bluemix provides a dashboard for you to create, view, and manage your applications and services as well as monitor your application’s resource usage. Bluemix dashboard also provides the ability to manage organizations, spaces, and user access.

IBM Insights for Weather service lets you retrieve weather data for an area specified by a geolocation. The data allows you to forecast, detect, and visualize disruptive weather events that might affect decision making in your application.

Node-RED is a tool for wiring together hardware devices, APIs and online services in new and interesting ways.Node-RED provides a browser-based flow editor that makes it easy to wire together flows using the wide range nodes in the palette. Flows can be then deployed to the runtime in a single-click.JavaScript functions can be created within the editor using the a rich text editor.A built-in library allows you to save useful functions, templates or flows for re-use.

Twilio is a mobile service that is available on Bluemix which allows software developers to programmatically make and receive phone calls and send and receive text messages using its web service APIs.

This tutorial will help you build a weather notification app that will send you weather update every morning and necessary precautions you have to take to save you from daily weather.

Prerequisites

Step 1: Create a Node-RED service in Bluemix and then bind Insights for Weather and Twilio Service

2

Step 2: Click on Environment Variables(visible in the left side) and then make note of weather insights username and password in a Notepad

3

Step 3: Goto https://twcservice.mybluemix.net/rest-api/ and click on twc_observations_current

4

Step 4: Change the geocode according to your geography and then scroll down

5

Step 5: Click on Try it out! You would be prompted to enter the username and password.Enter it from the notepad

6

Step 5: Save the Request URL, you will require that subsequently

7

Step 6: Goto the Bluemix App URL and then click on Node-RED flow editor. Start dragging in the nodes. You will require

  • Inject Node
  • Http Request Node
  • JSON node
  • Function node
  • Twilio node and
  • Debug node

Let’s configure each node and then wire them accordingly!

Inject node: It will be triggered, every day 6:00AM thereby sending weather notification SMS

trigger.PNG

Http Request Node:

Enter the REQUEST URL, Click on Basic Authentication and then enter the Weather insights credentials

http_request

JSON Node: It will convert the output string from Http Request to JSON format which is fed into a function

json.PNG

Output of JSON node:

json_output.PNG

Function node: Write a function to extract the value

function

Twilio node: Insert the twilio credentials, To number to receive the Notification

twilio.PNG

You can add a debug node to understand whether it is functioning properly.

Click on Deploy button which is in the top right corner and then click on the left side of the Inject node to trigger.

Yipee! I just received a notification!! 🙂 You can schedule to receive it everyday morning!

13235034_1082577601799736_714966582_o

Courtesy:IBM Bluemix™(bluemix.net), Twilio, Weather Insights and Node-RED

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s