Hackathons are all about building prototypes! Node-RED is a wonderful tool which makes prototyping a lot faster and easier! Node Red is very easy to get started with and is a great tool for beginners who want to write and understand programming flow.
It provides a lot of tools and plugins which supports almost everything related to programming. It can be used for APIs, Database, IOTIntro to IBM's Node-RED, WebSockets, Emails, Scripting, Image Processing, Cloud computing, edge computing, creating websites and lot more one can think of doing. It is based on NodeJS. In this workshop we will go over the basics of Node-RED to help you all get started with the prototyping process!
- Creating a IBM Cloud Account
- IBM Cloud Overview
- Node-RED Overview
- Concept of flows and nodes
- Input & Outputs
- Debug & inject nodes
- More Node-RED Resources
Presenter: Pooja Mistry
- Drag an Inject node from the palette
- Drag a Debug node from the palette and wire the two nodes together
- Double click on the Inject node and change it to inject an A-Z String "Hello World"
- Press the Red Deploy button in the top Right corner. Press the blue Inject. The Hello World string will appear in the Debug area.
flow can be found HelloWorld
- Drag a Language Translation node from the palette.
- Double click on the Language Translation node and select German (Language Translation Set up can be found in : How to request Access to Services )
- Connect the Language Translation node in between the Inject node and the debug node
- Press the Red Deploy button in the top Right corner. Press the blue Inject. The string from the inject node will appear in the Debug area along with the translated text.
flow can be found HelloWorldGerman
- Drag the function node from the palette and connect it between the inject node and debug node
- Double click on the function node and add code in the function input, e.g:
var newString = msg.payload.replace("World","Everyone , I hope you enjoy Node Red ");
return {payload : newString};
This example replaces World with Everyone, I hope you enjoy Node Red
flow can be found in HelloWorldReplace
- Drag the twitter input node from the palette and connect it with the debug message node
- Double click on the twitter node and set up twitter authentication
- Steps to set up Twitter
- Click on the little pencil button next to Twitter ID field
- Add Twitter ID
- Create your own application at
developer.twitter.com/en/apps
- Submit your API Keys and Access Tokens
- Once Twitter set up is complete you can receive tweets from hashtags, ids and any strings
- Press red Deploy button and see :
flow can be found in Twitter Example
This flow speaks the Berlin weather forecast in German
- Call the Weather Insights for the forecast in Berlin.
- Builds a sentence
- Call language translation to convert to German
- Call Text to Speech to generate a WAV file
- Plays the weather forecast in a German voice
flow can be found in Weather
- Drag the http node and create a Get Request
Set Method to GET
Set URL to /chat
-
Drag the template node and insert chat source code. Connect with Get Request souce code can be found at Chat Service Source Code
-
Drag http response node and connect with template node
-
Drag Websocket node to listen to http request node
-
Drag Funtion node and connect to websocket node
delete msg._session;
return msg;
- Drag websocket out node and listen on /ws/chat