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 and register the callback by using the following sample manifest.json content.

manifest.json
"events": {
  "onContactCreate": {
    "handler": "onContactCreateCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onContactCreate event.

  • 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 and register the callback by using the following sample manifest.json content.

manifest.json
"events": {
  "onContactUpdate": {
    "handler": "onContactUpdateCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onContactUpdate event.

  • 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 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.