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.
"events": {
"onUserCreate": {
"handler": "onUserCreateCallback"
}
}Define the corresponding callback by using the following sample server.js content:
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.
- actorobject
Details of the user who posted the message.
- associationsobject
Associated objects related to the message object. This value is null for the onUserCreate event.
- avatarobject
Image associated with the user.
- urlstring
Link from which the image is fetched.
- created_timestring
Timestamp of when the user information is created, specified in the UTC format.
- emailstring
Email address of the user.
- first_namestring
Business name of the user.
- idstring
Identifier of the user. This value is auto-generated when the conversation is initiated.
- last_namestring
Last name of the user.
- phonestring
Phone number of the user.
- propertiesobjects
Custom properties for additional user information. This attribute contains custom property names and the corresponding values, as a valid JSON object of key (custom property name)-value (custom property’s value) pairs.
- namestring
Name of the custom property.
- valuestring
Value of the custom property.
- reference_idstring
Identifier of external references, such as email or phone number, input by the user.
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.
"events": {
"onUserUpdate": {
"handler": "onUserUpdateCallback"
}
}Define the corresponding callback by using the following sample server.js content:
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.
- avatarimage object
Image associated with the actor.
- urlstring
Link from which the image is fetched.
- emailstring
Email address of the actor.
- first_namestring
Business name of the actor.
- idstring
Identifier associated with the actor, either agent_id or user_id .
- last_namestring
Last name of the actor.
- typestring
Descriptive identifier of the entity who updated the user details.
Possible values: agent, user
- 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.
- avatarobject
Image associated with the user.
- urlstring
Link from which the image is fetched.
- created_timestring
Timestamp of when the user information is created, specified in the UTC format.
- emailstring
Email address of the user.
- first_namestring
Business name of the user.
- idstring
Identifier of the user. This value is auto-generated when the conversation is initiated.
- last_namestring
Last name of the user.
- phonestring
Phone number of the user.
- propertiesobjects
Custom properties for additional user information. This attribute contains custom property names and the corresponding values, as a valid JSON object of key (custom property name)-value (custom property’s value) pairs.
- namestring
Name of the custom property.
- valuestring
Value of the custom property.
- reference_idstring
Identifier of external references, such as email or phone number, input by the user.