AlchemyAPI and NodeRED on Bluemix
Hickmat 100000QA3T Visits (11441)
When I spotted that AlchemyAPI were becoming part of the IBM Watson family I figured out it was time I had a bit of a play. Given may tooling environment of choice these days in NodeRED on Bluemix I decided that I would have a go at knocking up a quick Twitter sentiment analysis flow.
After reading the Deve
Next I set about creating my flow. As a goal I wanted to listen for Tweets on a particular subject and then do sentiment and entity analysis on the tweet data and finally store the results for later processing. As the results would be returned at a structure document (I decided I'd choose JSON as the output format) I opted to write the AlchemyAPI results to a pair of Cloudant Database. This resulted in my creating the following flow:
The Tweet node simply listens on a search string for a few HashTags and Twitter IDs. The "Move Payload to URL" function performs a encode on the Tweet string to make sure its suitable to be passed via an HTTP get and the node is configured as follows:
Each of the HTTP Request nodes are configured to call one of the required AlchemyAPI API's (Sentiment and Entity analysis) and the configuration looks like:
The actual URL is configured to use Mustache to substitute the encoded Twitter string and the full URL is set as (NB: I've blanked out my API key):
The final nodes in the flow simply write the returned JSON from the API call into Cloudant. At the moment I am writing the data to two different Cloudant databases but going forward I plan to use just one database.
With the flow pulled together I deployed it and data stared to be populated into my Cloudant databases. Wow that was easy I'm not doing much with the data just now but again I plan to expand on this and pull out insights from the raw data and even try and use the Embedded reporting in Bluemix to do something a bit more funky but that will all be dependent on how much spare time I have over the next few weeks.
Anyway in summary calling AlchemyAPI from NodeRED running in Bluemix has proven to be an exceptionally simple task.