Configure onContactCreate and onContactUpdate

onContactCreate

When a contact is created, the onContactCreate event is invoked and the registered callback method is executed.

Subscribe to the onContactCreate event, register the callback, and define the corresponding callback by using the following sample server.js content.

server.js
exports = {
  events: [
    { event: "onContactCreate", callback: "onContactCreateCallback" }
  ],
  onContactCreateCallback: function(payload) {
    console.log("Logging arguments from onContactCreate event: " + JSON.stringify(payload));
  }
}

Attributes of the data object

  • associationsobject

    All associated objects of the contact object, which specify additional information pertaining to the contact created.

  • contactobject

    Information pertaining to the contact object created when the onContactCreate event is triggered.

onContactUpdate

When a contact is updated, the onContactUpdate event is invoked and the registered callback method is executed.

Subscribe to the onContactUpdate event, register the callback, and define the corresponding callback by using the following sample server.js content.

server.js
exports = {
  events: [
    { event: "onContactUpdate", callback: "onContactUpdateCallback" }
  ],
  onContactUpdateCallback: function(payload) {
    console.log("Logging arguments from onContactUpdate event: " + JSON.stringify(payload));
  }
}

Attributes of the data object

  • associationsobject

    All associated objects of the contact object, which specify additional information pertaining to the contact updated.

  • changesobject

    Information pertaining to the contact whose details are modified in the Freshsales Classic Suite system.

    Changes that triggered the onContactUpdate event, specified as a JSON object of the following format:

    "changes": {
      "misc_changes": {},
      "model_changes": {
        //For non-array attributes
        "<contact.attribute that changed>": ["Old value", "New value"]
      },
      "system_changes": {}
    }
  • contactobject

    Information pertaining to the contact object updated when the onContactUpdate event is triggered.