Configure onArticleCreate, onArticleUpdate, and onArticleDelete

onArticleCreate

When an agent creates an article and saves or publishes it in the knowledge base of the Freshworks system, the onArticleCreate event is triggered.

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

manifest.json
"events": {
  "onArticleCreate": {
      "handler": "onArticleCreateCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the agent who created and published an article in the knowledge base of the Freshdesk system.

  • articleobject

    Information pertaining to the article created in the knowledge base of the Freshdesk system.

  • associationsobject

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

onArticleUpdate

When an agent updates or modifies the knowledge base article created in the Freshworks system, the onArticleUpdate event is triggered. An article can be updated only if the first draft is already saved in the Freshworks system or if a published draft is unpublished and further modified for corrections before republishing.

Modifications to the following fields of the article triggers the onArticleUpdate event:

  • Title
  • Content
  • Article Properties
    • Author
    • Folder
    • Tags
    • Title for Search Engine Optimization
    • Description for Search Engine Optimization

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

manifest.json
"events": {
  "onArticleUpdate": {
    "handler": "onArticleUpdateCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who updated the article in the knowledge base of the Freshdesk system. Only an agent can modify the articles in the knowledge base.

  • articleobject

    Information pertaining to the knowledge base article that is edited or modified in the Freshdesk system.

  • associationsobject

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

  • changesobject

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

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

    Example:

    "changes": {
      "misc_changes": {},
      "model_changes": {
        "description": [
          "<p dir=\"ltr\">updated solution article</p>",
          "<p dir=\"ltr\">updated solution article content</p>"
        ]
        "description_text": [
          "updated solution article",
          "updated solution article content"
        ]
        "modified_at": [
          "2021-10-29T13:04:00Z",
          "2021-10-29T13:04:05Z"
        ]
        "updated_at": [
          "2021-10-29T13:04:00Z",
          "2021-10-29T13:04:06Z"
        ]
        "published_at": [
          "2021-10-29T13:04:00Z",
          "2021-10-29T13:04:05Z"
        ]
      },
      "system_changes": {}
    }

onArticleDelete

When an article is deleted from the knowledge base of the Freshworks system, the onArticleDelete event is triggered. This event is triggered only when an article saved as a draft in the Freshworks system is deleted or when a folder or category under which an article is saved is deleted.

The Freshworks system does not allow an agent to delete a published article; it has to be unpublished before deletion.

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

manifest.json
"events": {
  "onArticleDelete": {
    "handler": "onArticleDeleteCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who deleted the article saved in the knowledge base of the Freshdesk system.

  • articleobject

    Information pertaining to the article that is deleted from the knowledge base of the Freshdesk system.

  • associationsobject

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