The onAgentUpdate event is triggered and the registered callback method is executed, when:
- The agent status is modified.
- The agent signs in or out of the Freshworks system.
Subscribe to the onAgentUpdate event and register the callback by using the following sample manifest.json content.
"events": {
"onAgentUpdate": {
"handler": "onAgentUpdateCallback"
}
}
Define the corresponding callback by using the following sample server.js content:
exports = {
onAgentUpdateCallback: function(payload) {
console.log("Logging arguments from onAgentUpdate event: " + JSON.stringify(payload));
}
}
Attributes of the data object
- actorobject
Information pertaining to the entity (agent/ user) who triggered the onAgentUpdate event in the Freshworks system.
- agentobject
Information pertaining to an agent whose details are modified in the Freshworks system.
- associationsobject
All associated objects of the agent object, which specify additional information pertaining to the agent.
- changesobject
Changes that triggered the onAgentUpdate event, specified as a JSON object of the following format:
{ "model_changes": { //For non-array attributes "<agent.attribute that changed>": ["Old value", "New value"] } }
Example
{ "model_changes": { "updated_at": [ "2022-08-29 18:45:26 UTC", "2022-08-30 08:05:50 UTC" ] } }