Configure onSurveyCreate and onSurveyUpdate

onSurveyCreate

When a customized survey is created and configured to a Freshworks account, the onSurveyCreate event is triggered.

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

manifest.json
"events": {
    "onSurveyCreate": {
        "handler": "onSurveyCreateCallback"
    }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onPortalSolutionCategoryCreate event.

  • associationsobject

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

  • surveyobject

    Information pertaining to the solution category created and customized to reflect in the customer portal of the Freshdesk system.

onSurveyUpdate

When an agent edits the details of the survey created and saved in the Freshworks system, the onSurveyUpdate event is triggered. Modifications to the following fields of the survey details triggers the onSurveyUpdate event:

  • Survey name
  • Survey question
  • Rating order
  • Point scale
  • Thank you text
  • Additional questions
  • Point scale for additional questions
  • Additional comments
  • Thank you text for additional feedback
  • Send while option
  • Link text

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

manifest.json
"events": {
    "onSurveyUpdate": {
        "handler": "onSurveyUpdateCallback"
    }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onSurveyUpdate event.

  • associationsobject

    All associated objects of the survey object, that specify additional information pertaining to the survey updated.

  • changesobject

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

    "changes": {
    "model_changes": {
     //For non-array attributes
     "<category.attribute that changed>": ["Old value", "New value"]
        },
    "system_changes": {},
    "misc_changes": {}
    }
    Example
    "changes": {
      "model_changes": {
        "title_text": ["survey", "Sample survey!"],
        "can_comment": ["0", "0"],
        "active": ["0", "0"],
        "updated_at": ["2021-12-02T02:50:27-05:00", "2021-12-02T02:50:38-05:00"]
      },
      "system_changes": {},
      "misc_changes": {}
    }
  • surveyobject

    Information pertaining to the solution category created and customized to reflect in the customer portal of the Freshdesk system.