Configure onAgentActivityCreate

Marketplace Platform v2.3 deprecation:We’re continuing to improve the Marketplace Platform to deliver stronger security, better performance, and new capabilities. As part of this evolution, Marketplace Platform v2.3 will be deprecated. To learn the dates and next steps, see Migration guide.

Agent activity is a metric that helps supervisors to assess how agents spend their business hours when they are unavailable in the Freshchat system. Your app can respond to changes in the availability of agents through the onAgentActivityCreate event.

The event is triggered and the registered callback method is executed, when:

  • In the Freshchat system, the general availability of an agent changes (from online to offline and vice versa).
  • The agent's Intelliassign status changes.

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

manifest.json
"events": {
  "onAgentActivityCreate": {
    "handler": "onAgentActivityCreateCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onAgentActivityCreate event in the Freshchat system.

    • avatarobject

      Image associated with the actor.

      • urlstring

        Link from which the image is fetched. The value of this attribute is null when the actor.type is system.

    • emailstring

      Email of the actor. The value of this attribute is null when the actor.type is system.

    • first_namestring

      First name of the actor.

      The value of this attribute is null when the actor.type is system.

    • idstring

      Identifier of the actor who triggered the product event.

    • last_namestring

      Last name of the actor.

      The value of this attribute is null when the actor.type is system.

    • login_statusboolean

      Specifies whether the actor is logged into the Freshchat system.

      Possible values: true, false

    • org_actor_idstring

      Organization-level identifier of the actor who triggered the onAgentActivityCreate event.

      The value of this attribute is null when the actor.type is system.

    • org_contact_idstring

      Auto-generated identifier of the actor (if the actor is a Freshchat agent), created when the actor is saved as a contact in the Freshworks’ system.

    • phonestring

      Phone number of the actor.

      The value of this attribute is null when the actor.type is system.

    • social_profilesarray of objects

      Social platforms in which the actor is available.

      • idstring

        User ID of the agent on the platform.

      • typestring

        Name of the social media platform.

        Possible values: facebook, twitter, skype, linkedin

        The value of this attribute is null when the actor.type is system.

    • sub_entitystring

      Routing sub-type that causes the Intelliassign status of an agent to change.

      If the agent_activity.availability_agent_type is GeneralAvailability, this attribute value is null.

    • typestring

      Name of the entity that triggered the product event.

      Possible values: agent, system

      If the agent_activity.availability_agent_type is GeneralAvailability, this attribute value is system.

  • agent_activityobject

    Information pertaining to the agent’s activity.

    • availability_event_typestring

      Type of change that triggered the onAgentActivityCreate event.


      Possible values:

      • GeneralAvailability: The status of the agent is modified to available or unavailable based on the agent’s activity. When an agent is inactive for a specific time period, the availability status is modified to unavailable.
      • Intelliassign: The availability status of the agent is modified based on whether the agent is available for auto-assignment of conversation. For more information, see IntelliAssign in Freshchat.
    • custom_status_idstring

      Identifier of the custom status object, auto-generated when a custom status is created in the Freshchat account.


      If agent_activity.availability_event_type is Intelliassign and a custom status is set for the agent, the custom_status_id value is the identifier of the custom status.


      If agent_activity.availability_event_type is GeneralAvailability, this attribute value is null.

    • emailstring

      Email address of the agent.

    • emojistring

      Emoji associated with the status of the agent.

    • org_agent_idstring

      Organization-level identifier of the agent.

    • prev_statusstring

      Previous status of the agent - the status before the onAgentActitvityCreate event trigger.

    • prev_status_change_timestampstring

      Timestamp of when the previous status was changed from the status before that, specified in the UTC format.

    • statusstring

      Availability status of the agent in the Freshchat system. The value of this attribute is based on the type of event that modified the status of the agent.

      If the value of agent_activity.availability_event_type is GeneralAvailability, the value of this attribute is AVAILABLE or UNAVAILABLE based on whether the agent is available online.

      If the value of agent_activity.availability_event_type is Intelliassign, the value of this attribute is AVAILABLE, UNAVAILABLE, or the custom status that is updated by the agent.

      Note:New custom statuses, such as Away, In a meeting, and so on, can be added if the custom activity state feature is enabled for a business account that uses Freshchat.

      Possible values: AVAILABLE, UNAVAILABLE, or the name of the custom status set by the agent.

    • status_change_timestampstring

      Timestamp of when the availability status is modified in the Freshchat system, specified in the UTC format.