ibm-watson-cognitive AlchemyLanguage Combined Call: use multiple functions in a single API call (Node.js)


The Combined Call method allows you to use multiple AlchemyLanguage functions in one request. This example uses a Combined Call to get entities and keywords from the IBM website and returns sentiment information for each result.

This example requires AlchemyLanguage service credentials and Node.js.

  1. Use a command-line interface to install the Watson Developer Cloud Node.js SDK:
$ npm install watson-developer-cloud
  1. Save the following code to an app.js file in the same directory. Make sure you replace API_KEY with your AlchemyAPI key:
var AlchemyLanguageV1 = require('watson-developer-cloud/alchemy-language/v1');
var alchemy_language = AlchemyLanguageV1({
  api_key: 'API_KEY'

var parameters = {
  extract: 'entities,keywords',
  sentiment: 1, 
  url: ''

alchemy_language.combined(parameters, function (err, response) {
  if (err)
    console.log('error:', err);
    console.log(JSON.stringify(response, null, 2));
  1. Run the app:
$ node app.js