Node-RED User Interface |
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.
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 |
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 |
I have published that node here on GitHub.
No comments:
Post a Comment