Tuesday, November 18, 2014

Node-RED, IBM Mobile Push Notification (Xtify) & Bluemix

Today, I investigated Node-RED. Node-RED is a tool for wiring together hardware devices, APIs and online services in new and interesting ways. It has been developed by IBM Emerging Technology.

Node-RED User Interface
Node-RED is available either on-premise or directly on IBM Bluemix. Node-RED provides by default several nodes like Social (twitter, IRC, XMPP...), Hardware (Raspberry Pi,...), Storage (FileSystem, MySQL...), as well as IBM Mobile Push and Watson services on Bluemix.

One great thing with Node-RED is the ability to create your own node, developed with Node.JS.
IBM owns a SaaS service named IBM Mobile Push Notification aka Xtify. It comes with a mobile SDK supporting Apple iPhone, Apple iPad, Android, Microsoft Windows 8 and BlackBerry apps.

I have created my node using the REST API of that service to be able to notify people in a Node-RED flow on their mobile.

I have used that tutorial to create and deploy my node : http://nodered.org/docs/creating-nodes/

After the deployment, I had a new node in the palette in the Mobile Section.

My node has four properties :
  • appKey: Describing the mobile app you'd like to target with this content.
  • apiKey: Generated in the IBM Mobile Push developer console.
  • xid:  ID linked to the specific device you want to target.
  • Subject: String which is the subject line of the message.
These variables are linked to the IBM Mobile Push APIs.
Properties box of my node

The content of the message will come with the payload from the previous node in the flow.

In order to test it, you can create a very simple flow using two nodes : Inject & xtify.

Node-RED Flow

Or you can imagine other uses cases like:

Tweets Sentiment Notifier
In that example, I want to be notified via email for negative tweets, archived in a file for neutral tweets and via my mobile for positive tweets.

But, we can also imagine to use Mobile Push Notification in the context of Internet of Things (IoT).
For example, a Raspberry Pi or a "Connected Thing" sending a MQTT or TCP message.

Use Case:
  • An App on my phone called "My Own Track" send my location to Node-RED via a MQTT message.
  • Use my location and query OpenWeatherMap API for the weather at that location
  • The returned data is then formatted in to my simple message using further function nodes
  • The message is then sent to my mobile via IBM Mobile Push
Weather Forecast
All of these examples combine the power of the connectivity of Node-RED and the SaaS Mobile Push services. It works with both Node-RED implementations (on-prem/cloud).
I have published that node here on GitHub.