Get Your API Credentials

If you haven't already done so, you will need to sign up.

Sign up to our free plan here: developer.aylien.com/signup.

The Free plan allows you to make 1,000 calls/day for free. For further information on paid plans please visit our plans page.

Getting Started with AYLIEN Text Analysis API Using Node.js

Requirements

  • Node.js

Getting the SDK

The easiest way to get the Node.js SDK is to use npm.

npm install aylien_textapi

Using the SDK

The following example demonstrates how to calculate the sentiment of a simple sentence, and determine the language it's written in.

var AYLIENTextAPI = require("aylien_textapi");
var textapi = new AYLIENTextAPI({
  application_id: "YourApplicationId",
  application_key: "YourApplicationKey"
});
var text = "John is a very good football player!";

textapi.sentiment({"text": text}, function(error, response) {
  if (error === null) {
    console.log(response);
  }
});

textapi.language({"text": text}, function(error, response) {
  if (error === null) {
    console.log(response);
  }
});