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.
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.
- IBM Bluemix Account – Take a 30 day free trial here http://ibm.biz/bluemixapp
- Twilio API credentials and Twilio number
- Request URL from IBM Insights for Weather API
Step 1: Create a Node-RED service in Bluemix and then bind Insights for Weather and Twilio Service
Step 2: Click on Environment Variables(visible in the left side) and then make note of weather insights username and password in a Notepad
Step 3: Goto https://twcservice.mybluemix.net/rest-api/ and click on twc_observations_current
Step 4: Change the geocode according to your geography and then scroll down
Step 5: Click on Try it out! You would be prompted to enter the username and password.Enter it from the notepad
Step 5: Save the Request URL, you will require that subsequently
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
Http Request Node:
Enter the REQUEST URL, Click on Basic Authentication and then enter the Weather insights credentials
JSON Node: It will convert the output string from Http Request to JSON format which is fed into a function
Output of JSON node:
Function node: Write a function to extract the value
Twilio node: Insert the twilio credentials, To number to receive the Notification
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!
Courtesy:IBM Bluemix™(bluemix.net), Twilio, Weather Insights and Node-RED