Create a flow in Node-RED using Watson APIs

Yacine Rezgui
IBM watsonx Assistant
3 min readJun 14, 2016

--

Last time, I wrote an article to show you how to start with Node-RED. In this post, I assume you already deployed your instance following the instructions previously written. If you haven’t done them yet, read this article.

As you can notice, when you deploy Node-RED from my previous article, you’ll get a lot of tabs already filled with flows:

As some Watson APIs can be complex, we made all the possible actions available in flows that can be configured to save you a huge amount of time. We are nice people at IBM :)

Our first flow will be a quick demo of Watson Translation API. We will write a sentence in English and translate it to French.

Let’s create a new flow and drag an inject node, select string type and set it to “Hello mister President”:

We have to instantiate of Watson Translation service. If you don’t already have one, click on this image to create one:

Create your instance of the service. In this exercise, we will not bind the service but copy manually the credentials into your Node-RED app:

Now go back to your Node-RED, drag a Watson Translate node and paste your credentials into the node settings. After clicking ok, reopen the node and you will see other parameters. Set domain to Conversational, source to English and target to French:

Finally, add a debug node at the end of the flow, link the nodes and deploy:

Trigger the flow by clicking to the button next to the first node and check out the debug tab on the right sidebar. You can see the sentence translated in French:

Success! Now give a try by creating your own flows or customise the others by selecting on the preexistent tabs.

Next time, we will complexify our flow to use another API and display the result on a webpage.

--

--

Yacine Rezgui
IBM watsonx Assistant

🇫🇷🇹🇳 Developer Relations Engineer 🥑 on Android working on privacy @Google in London. Hacking projects on free time