Configure onUserCreate and onUserUpdate

onUserCreate

When a user initiates a conversation, the onUserCreate event is invoked and the registered callback method is executed.

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

manifest.json
"events": {
  "onUserCreate": {
    "handler": "onUserCreateCallback"
  }
}

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

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

Attributes of the data object

  • userobject

    Information pertaining to the entity who triggered the onUserCreate event.

onUserUpdate

When a user's information is updated, either by the user or agent, the onUserUpdate event is invoked and the registered callback method is executed.

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

manifest.json
"events": {
  "onUserUpdate": {
    "handler": "onUserUpdateCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Details of the person who modified the user information.

  • associationsobject

    Associated objects related to the message object. This value is null for the onUserCreate event.

  • changesobject

    Changes that triggered onUserUpdate, specified as a JSON object of the following format.

    {
    "user object field that changed": ["New value", "Old value"]
    }
  • userobject

    Information pertaining to the entity who triggered the onUserCreate event.