Configure onMessageCreate

When a message is posted, either by the agent or user, the onMessageCreate event is invoked and the registered callback method is executed.

Subscribe to the onMessageCreate event and register the callback by using the following sample manifest.json content.

manifest.json
"events": {
  "onMessageCreate": {
    "handler": "onMessageCreateCallback"
  }
}

Define the corresponding callback by using the following sample server.js content:

server.js
exports = {
  onMessageCreateCallback: function(payload) {
    console.log("Logging arguments from onMessageCreate event: " + JSON.stringify(payload));
  }
}

Attributes of the data object

  • actorobject

    Details of the entity that posted the message.

  • associationsobject

    Associated objects related to the message object.

  • messageobject

    Details of the message that triggered the onMessageCreate event.