function chatUpdateSetup() {
    var currentRequestPayloadSetter = Api.setRequestPayload;
    Api.setRequestPayload = function (newPayloadStr) {
      currentRequestPayloadSetter.call(Api, newPayloadStr);
      displayMessage(JSON.parse(newPayloadStr), settings.authorTypes.user);
    };

    var currentResponsePayloadSetter = Api.setResponsePayload;
    Api.setResponsePayload = function (newPayloadStr) {
      currentResponsePayloadSetter.call(Api, newPayloadStr);
      displayMessage(JSON.parse(newPayloadStr).result, settings.authorTypes.watson);
    };

    Api.setErrorPayload = function (newPayload) {
      displayMessage(newPayload, settings.authorTypes.watson);
    };
  }
// This causes the displayMessage function to be called when messages are sent / received
This causes the displayMessage function to be called when messages are sent / received
This causes the displayMessage function to be called when messages are sent / received
function chatUpdateSetup() {
    var currentRequestPayloadSetter = Api.setRequestPayload;
    Api.setRequestPayload = function (newPayloadStr) {
      currentRequestPayloadSetter.call(Api, newPayloadStr);
      displayMessage(JSON.parse(newPayloadStr), settings.authorTypes.user);
    };
    var currentResponsePayloadSetter = Api.setResponsePayload;
    Api.setResponsePayload = function (newPayloadStr) {
      currentResponsePayloadSetter.call(Api, newPayloadStr);
      displayMessage(JSON.parse(newPayloadStr).result, settings.authorTypes.watson);
    };
    Api.setErrorPayload = function (newPayload) {
      displayMessage(newPayload, settings.authorTypes.watson);
    };
  }
function chatUpdateSetup ( ) { var currentRequestPayloadSetter = Api . setRequestPayload ; Api . setRequestPayload = function ( newPayloadStr ) { currentRequestPayloadSetter . call ( Api , newPayloadStr ) ; displayMessage ( JSON . parse ( newPayloadStr ) , settings . authorTypes . user ) ; } ; var currentResponsePayloadSetter = Api . setResponsePayload ; Api . setResponsePayload = function ( newPayloadStr ) { currentResponsePayloadSetter . call ( Api , newPayloadStr ) ; displayMessage ( JSON . parse ( newPayloadStr ) . result , settings . authorTypes . watson ) ; } ; Api . setErrorPayload = function ( newPayload ) { displayMessage ( newPayload , settings . authorTypes . watson ) ; } ; }
This causes the displayMessage function to be called when messages are sent / received
This causes the displayMessage function to be called when messages are sent / received