Skip to content

Activity Callbacks

Activity Callbacks lets administrators inject system-wide logic that runs when activities are recorded.

Open Messaging and Automation → Activity Callbacks.

Use this page when Emakin needs to trigger custom behavior such as external notifications or integration-side effects. Every enabled callback that contains code runs asynchronously for every activity, so the callback code must decide which activity types it handles.

Typical Use Case

A common use case is push notification: when a work item is assigned, a callback can send a custom notification to another system.

Settings Reference

Is Enabled?

Controls whether the callback is active.

Name

Identifier used to recognize the callback.

Callback Code

Script executed when the callback is triggered.

Available predefined variables are:

Variable Name Description
$Domain Domain in which the activity was recorded
$Targets Array of target identities
$Activity JSON object representing the activity

$Targets contains only activity targets for which notification is enabled. If one callback fails, Emakin logs the error and continues with the remaining callbacks.

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
if ($Activity.objectType == 'workitem' && $Activity['@type'] == 'assign') {

    var payload = {
        targets: $Targets.map(function (identity) {
            return identity.Id;
        }),
        message: $Activity.task + " " + $Activity.instructions
    };

    var client = $Rest.Create('http://localhost/post');

    client.Request().AddObject(payload).ExecuteJson();
}