API Version: Development
var IPCortex = require('ipcortex-pabx');
IPCortex.PBX.Auth.setHost('https://pabx.hostname');
IPCortex.PBX.Auth.login({
  username: '<username>',
  password: '<password>'
}).then(
  function() {
    console.log('Login successful');
    /* Get the API to start collecting data */
    IPCortex.PBX.startFeed().then(
      function() {
        console.log('Live data feed started');
        /* Enable the chat subsystem */
        IPCortex.PBX.enableChat(
          /* Provide a callback for new rooms */
          function (ourRoom) {
            /* Add an update listener to each new room */
            ourRoom.addListener('update', function (room) {
              /* Inspect new messages and echo ... */
              room.messages.forEach(function (message) {
                console.log(message.cN + ' has decreed: ' + message.msg);
                /* ... except my own messages */
                if (!message.own)
                room.post('Apparently you decreed: ' + message.msg);
              });
            });
          }
        );
      },
      function() {
        console.log('Live data feed failed');
      }
    );
  },
  function() {
    console.log('Login failed');
  }
);npm init
npm install --save ipcortex/node-api
node node_modules/ipcortex-pabx/updateAPI.js http://pabx.hostnamenode (e.g. node index.js). You should receive all the appropriate success messages.NODE_TLS_REJECT_UNAUTHORIZED environment variable to 0. However, please don't use this in anything near a production system as this is essentially turning off security.