Configure onAgentStatusCreate, onAgentStatusUpdate, and onAgentStatusDelete

onAgentStatusCreate

The onAgentStatusCreate event is triggered and the registered callback method is executed, when a custom agent status is created in the Freshworks system.

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

manifest.json
"events": {
    "onAgentStatusCreate": {
         "handler": "onAgentStatusCreateCallback"
    }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onAgentStatusCreate event in the Freshdesk system.

  • agent_statusobject

    Information pertaining to the agent status created in the Freshdesk system.

  • associationsobject

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

onAgentStatusUpdate

The onAgentStatusUpdate event is triggered when there are modifications to the following attributes of an agent’s status:

  • Status name
  • Emoji (icon associated with the status)
  • State

Note:Only an agent with admin level permissions can modify the state of a custom status.

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

manifest.json
"events": {
    "onAgentStatusUpdate": {
        "handler": "onAgentStatusUpdateCallback"
    }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onAgentStatusUpdate event in the Freshdesk system.

  • agent_statusobject

    Updated information pertaining to the agent status that is modified in the Freshdesk system.

  • associationsobject

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

  • changesobject

    Changes that triggered the onAgentStatusUpdate specified as a JSON object of the following format:

    {
      "model_changes": {
        "<agent_status.attribute that changed>": ["Old value", "New value"]
      }
    }

    Example

    {
      "misc_changes": {},
      "model_changes": {
        "name": [
          "Test One",
          "Test Changed"
        ],
        "updated_at": [
          "2022-06-09T04:15:32Z",
          "2022-06-09T04:18:40Z"
        ]
      },
      "system_changes": {}
    }

onAgentStatusDelete

The onAgentStatusDelete event is triggered when:

  • An admin deletes the custom statuses configured in the Freshworks system.
  • Account deletion or moving the account to a plan that does not support custom statuses causes the Freshworks system to automatically delete the custom statuses.

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

manifest.json
"events": {
    "onAgentStatusDelete": {
        "handler": "onAgentStatusDeleteCallback"
    }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onAgentStatusDelete event in the Freshdesk system.

  • agent_statusobject

    nformation pertaining to the agent status deleted from the Freshdesk system.

  • associationsobject

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