Overview

Skill Level: Any Skill Level

Beginner

Ingredients

Bluemix Account

2 Twitter Accounts

Step-by-step

  1. Introduction

    Let’s suppose that you want to write your tweets for different audiences. Bluemix Node-Red can easily fetch your posts from a primary Twitter account (in English, for example), translate the message and post the translated post to another Twitter account(s).

    In order to create your twitter accounts, you need an email for each one. In this example, I’ve created gmail accounts for each twitter account.

    Because red-node does not process all the tweets, we’ll use the hashtag #translate to trigger the translation process.

  2. Add a Watson Language Translation API

    Don’t forget to add the service to the node-red application, otherwise you’ll have to provide the service credentials manually.

  3. Get a Node-Red instance

    From the catalog, choose the Node-red starter boilerplate and create a new instance.

    Then, open your node-red editor (url will be something like http://twittertranslation.mybluemix.net/red/ )

    Create a flow like this

  4. Configure the Inbound Twitter account

    So the idea here is to fetch twitter posts from a master account (leoks_en), translate each post and send to another account (leoks_pt).

    Double-click the first node on the left

    Before adding the credentials, logout from any twitter account in your browser, so you can choose the right account.

    I

  5. Configure your translation node

    Double click in the middle node (language translation) and configure the source and target languages

  6. Give it a try

    Now you have to deploy your flow

    Now, let’s send a tweet using the leoks_en twitter account:

    and here’s what we’ve got on the other side (leoks_pt)

  7. Configure a filter (switch) to select only your own Tweets

    Double-click the switch node (orange one) and set it like this:

  8. Configure the Outbound Twitter Account

    Double click on the node on the right, and choose the option to use a different credential

  9. Conclusion

    Node-red is incredibly easy to use and highly configurable and well integrated with Watson services.

    Also, take a look on the node-red community flows here (http://flows.nodered.org/) and take a look on this active community (https://groups.google.com/forum/#!forum/node-red)

2 comments on"Translate Your Tweets In Real-Time Using Bluemix and Watson"

  1. DaniloSilveiraBH April 29, 2016

    Thanks! Used this tutorial as an example to build mine. And I tested the Node-red as well!

Join The Discussion