Analyzing text messages via the Tone Analyzer service

I’m at the Twilio SIGNAL conference with an update to Tone LED Pin demo. If you recall, I analyzed tweets from Twitter around a hashtag or search term and took the most prevalent social tone from IBM Watson’s Tone Analyzer service to graph per minute stats on an NeoPixel LED ring. Yes, it is still a glorious wearable pie chart.

Taking advantage of the super simple to use Twilio service, I connected a phone number that takes in text messages and process those instead of tweets. The changes to my application were also pretty simple, removing one node and adding three nodes. Here’s how I modified my application to use Twilio. If you haven’t deployed the application, you find the instructions on a previous blog post.

First, let’s setup an HTTP endpoint in the Node-RED application instead of the Twitter node. Delete the Twitter node. Add a HTTP endpoint to expose the processing flow to the URL /twiliocallback.

twilio2

Add a change node to move some data around. The first rule preserves the text message info in the msg.text property, useful if you want to respond back to the phone number the message comes from. The second rule sets the msg.payload property to the body of the text message, which is used by the Tone Analyzer node.

twilio3

Finally, add a HTTP response node, and connect the nodes together as shown below.

twilio4

Click on Deploy in the top right corner. That’s it for the application. All that’s left is to get a phone number from Twilio and instruct Twilio where to send the text messages to.

Register for a Twilio account and create a new phone number. You can take a little creative time to find that really awesome phone number using their search tool.

On the settings page for your new Twilio number, set the messaging webhook to point to your Node-RED application’s HTTP endpoint.

twilio5

Send a text message to the Twilio phone number and see the results from the IBM Watson Tone Analyzer service included in the graphs and on the connected LED Pin.

Posted in Conferences, Node-RED | Comments Off on Analyzing text messages via the Tone Analyzer service

AlchemyAPI Hack Night

On Tuesday night, IBM hosted a Hack Night at Hacker Dojo. The topic of the night was the suite of APIs offered by the AlchemyAPI service in IBM Bluemix. We discussed three of Alchemy’s services: Language, Vision, and Data News. You can find the AlchemyAPI lab we used in my Node-RED labs available on GitHub.

alchemy

In the first part of the lab, I showed how to analyze a news blog post and extract entities, keywords, sentiment, emotions, and other attributes. The REST-based API is simple to use, allowing multiple types of inputs: text, HTML, or a URL where the content resides.

This lab uses Node-RED, a graphical interface of nodes built on top of Node.js. It offers a quick drag and drop interface to prototype ideas. You could also choose to use IBM Watson SDKs available in other languages if you want.

alchemy2

alchemy3

Keeping flexibility in mind, I designed the flow to output two formats: a human-friendly webpage and a JSON response. The JSON response flow could be modified to add more results from other services, or reduced with your own custom logic.

alchemy4

alchemy5

The second part of the lab showed how to use the AlchemyVision API to analyze images and get information about people pictured. For example, a picture of the President of the United States is recognized as Barack Obama and provides attributes like his gender and age-range, and categories (President, Person, Politician).

Again, the REST-based API is pretty flexible on the inputs: an image or a URL to an image. Did you know you can also provide a URL of a webpage where AlchemyAPI will look for the main image and analyze that?

I split the flow and display a simple webpage that’s human-friendly and also offer a option for a JSON response.

alchemy6

alchemy7

alchemy8

The rest of the evening was spent in groups brainstorming ideas of how the service could be used in new and existing applications. Some ideas that the hackers came up with included:

  • use AlchemyData News to determine if it good time to buy or sell stocks based on what the news is saying about a company
  • analyze Instagram photos to track trends over time of what is being photographed
  • ensure profile pictures on social networks are of people instead of cats
  • a conference room assistant that listens for keywords and captures images
  • an intrusion detection system that uses AlchemyVision

Hopefully this lab provides a starting point and understanding of what the Alchemy APIs offer and how easy it is to get started via the Node-RED boilerplate or in code directly interacting with the API endpoints.

Posted in Hackathons, Node-RED | Comments Off on AlchemyAPI Hack Night