Configure onAgentAvailabilityUpdate

Important:This product event is triggered only for Freshdesk Omnichannel/ Support Desk accounts for which the custom status feature is enabled.

In the Freshdesk system, custom agent statuses enable admins and supervisors to obtain visibility into how agents spend their time when they are unavailable to assist customers. For more information, see Custom statuses - for Omnichannel and for Support Desk.

Notes:
  • For new Freshdesk Support Desk sign-ups, the custom status feature is available by default.
  • For Freshdesk Omnichannel accounts, to enable the custom status feature, contact Freshdesk support.

Freshdesk Omnichannel enables businesses to support its customers across multiple channels such as Ticket (the helpdesk system), Chat (the chat system), and Phone (the telephony system). An agent’s availability across these channels can be monitored on the Omnichannel agent availability dashboard.

The onAgentAvailabilityUpdate event is triggered when:

  • An admin modifies the availability status of an agent on the availability dashboard.
  • An agent updates their profile and modifies the availability status.
  • An agent’s activity such as responding to a call causes the system to modify the agent’s availability status.

The onAgentAvailabilityUpdate event is not triggered when an agent logs into or logs off from the Freshdesk system. To enable your app to respond to log-in changes, you can use the onAgentUpdate event.

For Freshdesk Support Desk accounts or Freshdesk Omnichannel accounts that do not have the custom status feature enabled, any modification to an agent’s availability triggers the onAgentUpdate event.

For Freshdesk Support Desk accounts or Freshdesk Omnichannel accounts that have the custom status feature enabled, any modification to the agent’s availability triggers the onAgentAvailabilityUpdate event.

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

manifest.json
"events": {
  "onAgentAvailabilityUpdate": {
    "handler": "onAgentAvailabilityUpdateCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

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

  • agent_availabilityobject

    Updated information pertaining to an agent’s availability across the multiple channels in the Freshdesk system.

  • associationsobject

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

  • changesobject

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

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

    Example

    {
      "model_changes": {
        "status_id": [
          123,
          232
        ],
        "status_updated_at": [
          "2022-06-09T02:18:41Z",
          "2022-06-09T04:18:41Z"
        ],
        "channel_availability": [
          [
            {
              "channel": "freshdesk",
              "available": true,
              "channel_account_id": "432",
              "agent_id": "32938"
            },
            {
              "channel": "freshchat",
              "available": true,
              "channel_account_id": "293829-sc38983u4-3u3ru38",
              "agent_id": "3282"
            },
            {
              "channel": "freshcaller",
              "available": true,
              "channel_account_id": "432",
              "agent_id": "432"
            }
          ],
          [
            {
              "channel": "freshdesk",
              "available": true,
              "channel_account_id": "432",
              "agent_id": "32938"
            },
            {
              "channel": "freshchat",
              "available": false,
              "channel_account_id": "293829-sc38983u4-3u3ru38",
              "agent_id": "3282"
            },
            {
              "channel": "freshcaller",
              "available": false,
              "channel_account_id": "432",
              "agent_id": "432"
            }
          ]
        ]
      }
    }