Integration Cookbook Chatterbox
Share!TwitterFacebookLinkedInGoogle+Email

Hey everyone, thanks for checking in again. This week, I’ll be covering my integration experience with Chatterbox. If you missed it, I covered Semantria last week, and AlchemyAPI the week before that. Again, I will try to be as objective as possible and highlight all aspects of the integration from my personal experience.

Chatterbox

The API is simple and supports only a few basic features, sentiment analysis being one of them. Chatterbox doesn’t have an SDK available, so I was forced to implement everything manually. This wasn’t a major problem, because of the simplicity of the implementation. Authentication was done through the custom header and a simple API key, so the entire code related to sentiment analysis requests looks like the following:

Dictionary<string, string> parameters = new Dictionary<string, string>();

parameters.Add("lang", LocaleHelper.GetDoubleLanguageAbbreviation(context.Language));
parameters.Add("text", Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(document.Value.Source)));

WebRequest request = WebRequest.Create("https://chatterbox-analytics-sentiment-analysis-free.p.mashape.com/sentiment/current/classify_text/");
request.Headers.Add("X-Mashape-Authorization", context.Key);
request.ContentType = "application/x-www-form-urlencoded";
request.Method = "POST";

In order to work with native objects, I added a small auxiliary class that is used for deserialization of the Chatterbox response from their sentiment analysis end-point.

[DataContract(Name = "sentiment")]
public sealed class ChatterboxSentiment
{
[DataMember(Name = "language")]
public string Language { get; set; }

[DataMember(Name = "value")]
public double Value { get; set; }

[DataMember(Name = "sent")]
public int Sent { get; set; }
}

After I had integrated with Chatterbox, the API worked as expected and analyzed documents asynchronously one by one.

Overall Opinion

Chatterbox doesn’t have its own infrastructure, so their API is published on Mashape API marketplace and because of this, an SDK is not available. However, Mashape offers sample code for easy integration. Integration itself is very straightforward and no specific configuration or settings are necessary.

 

Check in next week for my integration experience with Viralheat.

George Kozlov is a software engineering guru. He specializes in software research, architecture and maintenance. He co-founded Semantria, and is currently their CTO and go-to guy when things need improving.

Share!TwitterFacebookLinkedInGoogle+Email