Hello World

To get an idea of how easy it can be to extend Content Studio using the Javascript API:

  1. Start Content Studio in the usual way.

    • On Windows, select View from the menu bar while holding down the Ctrl key. An extra Debug option should be displayed at the bottom of the View menu.

    • On Macs, hold down theCtrl key and right click between the Content Engine address field and the publication name field in the Content Studio footer:

  2. Select Debug > Javascript console. A dialog containing a Javascript console is now displayed:

    graphics/console.png
  3. Enter the following Javascript statement in the Javascript console:

    require('notifier').notify('Hello world!');

    and press Enter. A message bubble containing your "Hello world!" message should immediately appear near the top right corner of the Content Studio window, and disappear after a few seconds:

    graphics/hello-world.png

The require function used in this one-line "Hello World" program asks Content Studio to create an object - in this case a notifier object that can be used to display notification messages. Usually, of course, you would assign the object to a variable so you can use it more than once. Try entering the following three lines in the console:

no = require('notifier');
no.notify('Hello again world!');
no.notify('Goodbye world!');