Configure onAgentCustomStatusUpdate

Agents can set their status to notify their availability for auto-assignment of conversation through IntelliAssign. The default statuses include Available, Unavailable, Ongoing call, and After call work. Agents can also create custom statuses such as In a meeting, Away from keyboard, and so on.

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

  • An agent’s existing default status is updated to a custom status or vice versa.
  • An agent’s status is updated from one custom status to another.

Note:The agents can set custom statuses only if the custom status feature is enabled for the product account. For more information, see Setting up agent status in Freshchat.

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

manifest.json
"events": {
  "onAgentCustomStatusUpdate": {
    "handler": "onAgentCustomStatusUpdateCallback"
  }
}

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

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

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onAgentCustomStatusUpdate event in the Freshworks system.

    • idstring

      Identifier of the actor who triggered the product event.

    • actor_sourcestring

      Entity who updated the agent's status.

    • 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.

    • 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 Freshworks system.


      Possible values: true, false

    • org_actor_idstring

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

    • 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_profilesstring

      Social platform in which the actor is available.

    • 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_custom_statusobject

    Details of the custom status set by the agent.

    • availability_event_typestring

      Type of agent status.


      The value of availability_event_type identifies the type of the status updated by the agent, which triggered the event.


      For onAgentCustomStatusUpdate, the value of availability_event_type is custom_status.

    • custom_status_idstring

      Identifier of the custom status, auto-generated when the custom status is created.

    • emailstring

      Email address of the agent who updated the agent status.

    • emojistring

      Emoji associated with the custom status.

    • org_agent_idstring

      Organization-level identifier of the agent who updated the agent status.

    • prev_statusstring

      Name of the previous agent status.

    • prev_status_change_timestampstring

      Timestamp of when the status was previously updated, specified in the UTC format.

    • statusstring

      Name of the current agent status.

    • status_change_timestampstring

      Timestamp of when the current status was set by the agent, specified in the UTC format.


      The time taken between each status could be figured out by comparing the status_change_timestamp and prev_status_change_timestamp. This helps with knowing how long the agent was unavailable.

  • associationsobject

    All associated objects of the agent_custom_status object, that specify additional information pertaining to the updated custom status.

  • changesobject

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

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

    Example

    "changes": { 
      "status": [
        "LUNCH",
        "UNAVAILABLE"
       ]
    }