Configure onUserAgentAvailabilityUpdate

In the Freshsales system, the user can update their availability by selecting available or unavailable.

Important:The user availability status is an internal feature and is not available for all Freshsales accounts.

When the user’s availability status is updated in the Freshsales system, the onUserAgentAvailabilityUpdate event is triggered.

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

manifest.json
"events": {
  "onUserAgentAvailabilityUpdate": {
    "handler": "onUserAgentAvailabilityUpdateCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onUserAgentAvailabilityUpdate event in the Freshsales system.

  • associationsobject

    All associated objects of the user agent availability object, that specify additional information pertaining to the availability of user/agent.

  • changesobject

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

    "changes": {
      //For array attributes
        "<user_agent_availability.attribute that changed>": {
            "changed": [
              ["Old value"],
              ["New value"]
            ]
        }
    }

    Example

    "changes":
    {
      "channel_preferences":
      {
        "changed":
        [
          [
            {
            "available": false,
            "channel": "chat",
            "enabled": true
            },
            {
            "available": true,
            "channel": "chat",
            "enabled": true
            }
          ],
          [
            {
            "available": false,
            "channel": "freshsales",
            "enabled": true
            },
            {
            "available": true,
            "channel": "freshsales",
            "enabled": true
            }
          ]
        ]
      }
    }
  • user_agent_availabilityobject

    Updated information pertaining to the availability of a user/agent across multiple channels in the Freshsales system.