Configure onFolderCreate, onFolderUpdate, and onFolderDelete

onFolderCreate

When an agent creates a folder, inside a category, to help organize articles in the knowledge base, the onFolderCreate event is triggered.

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

manifest.json
"events": {
  "onFolderCreate": {
      "handler": "onFolderCreateCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the agent who created a folder in the knowledge base of the Freshdesk system.

  • associationsobject

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

  • folderobject

    Information pertaining to the folder created by the agent in the knowledge base of the Freshdesk system.

onFolderUpdate

When an agent modifies the details of the folder created and saved in the Freshworks system, the onFolderUpdate event is triggered. Modifications to the following fields of the folder details triggers the onFolderUpdate event:

  • Name
  • Description
  • Category
  • Visibility
  • Order articles

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

manifest.json
"events": {
  "onFolderUpdate": {
      "handler": "onFolderUpdateCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who modified the folder details.

  • associationsobject

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

  • changesobject

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

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

    Example:

    "changes": {
      "misc_changes": {},
      "model_changes": {
        "name": [
          "FAQs",
          "Frequently Asked Questions"
        ],
        "updated_at": [
          "2021-10-29T13:46:04Z",
          "2021-10-29T13:46:14Z"
        ],
      },
      "system_changes": {}
    }
  • folderobject

    Information pertaining to the folder whose details are modified.

onFolderDelete

When an agent deletes a folder or a non-empty category, the onFolderDelete event is triggered.

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

manifest.json
"events": {
  "onFolderDelete": {
      "handler": "onFolderDeleteCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who deleted the folder.

  • associationsobject

    All associated objects of the folder object, which specify additional information pertaining to the deleted folder.

  • folderobject

    Information pertaining to the folder that is deleted from the Freshdesk system.