Configure onAgentAvailabilityUpdate

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

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.

    • idstring

      Identifier of the actor who triggered the product event.
      If the actor is an agent, the id value is the agent’s id that is auto-generated when the agent’s information is configured in the Freshdesk system.
      If the actor is the Freshdesk system, the id value is null.

    • namestring

      Full name of the actor.
      If the actor is the Freshdesk system, this attribute value is null.

    • typestring

      Specifies if it is an agent or the Freshdesk system that triggered the product event.
      Possible values: agent, system

  • agent_availabilityobject

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

    • account_idstring

      Identifier of the organization’s Freshdesk account, auto-generated when the account is configured.

    • channel_availabilityarray of objects

      Details of the multiple channels configured within the Freshdesk system and the availability status of the agent in each of these channels, specified as an array.

      • channelstring

        Name of the channel associated with the Freshdesk account.
        Possible values: freshdesk, freshchat, freshcaller

      • availableboolean

        Specifies whether the agent is available for ticket/ conversation/ call assignment in the corresponding channel.
        Possible values: true, false, freshcaller

      • channel_account_idstring

        Identifier of the organization’s account,auto-generated when the account is activated for the specific channel.

      • agent_idstring

        Identifier of the agent, auto-generated when the agent record is created in the channel.

    • created_atstring

      Timestamp of when the agent availability object is created in the Freshdesk system, specified in the UTC format.

    • Emailstring

      Email address of the agent.

    • idinteger

      Identifier of the agent availability object, auto-generated when the availability details of an agent is created in the agent availability dashboard (that is, when an agent is added to the Freshdesk system).

    • logged_inboolean

      Specifies whether the agent is logged into the Freshdesk system.
      Possible values: true, false, freshcaller

    • namestring

      Name of the agent.

    • status_idinteger

      Identifier of an status object, auto-generated when the agent status is configured in the Freshdesk system.

    • status_updated_atstring

      Timestamp of when the agent status was last updated in the Freshdesk system, specified in the UTC format.

    • updated_atstring

      Timestamp of when the agent availability object is last updated, specified in the UTC format.

  • associationsobject

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

    • statusobject

      Details of the status of the agent.

      • idstring

        Identifier of the status object, auto-generated when an agent status is configured in the Freshdesk system.

      • namestring

        Name of the status.

  • 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"
            }
          ]
        ]
      }
    }
    • misc_changesobject

      List of all miscellaneous database parameters whose values have changed, along with the old and modified values.

    • model_changesobject

      List of all attributes whose values have changed along with the old and modified values of the attributes.

    • system_changesobject

      List of all system-level parameters whose values have changed, along with the old and modified values.