Glue42 Notification Service

JavaScript

Architecture

GNS Architecture

Raising Notifications from a Web App

There is no JavaScript API for raising notifications, but you can easily do that using an Interop method, called T42.GNS.Publish.RaiseNotification, provided by the GNS Desktop Manager:

glue.interop.invoke(
    "T42.GNS.Publish.RaiseNotification", {
        notification: {
            title: "Critical Alert",
            severity: "High",
            description: "Your computer will be restarted in 30 seconds"
        }
    })
    .then(() => console.log("Raised a notification"))
    .catch(console.error);

Raising Notifications

Glue42 Routing

Glue42 Routing enables customization of GNS notifications delivery and display. Glue42 Routing can be applied at the source, category and notification level and is overridden in the same order, so that the Glue42 Routing in a notification overrides the one specified in the notification category, which overrides the one specified in the notification source.

There are 4 customizations you can make:

  • specify an Interop handler method which will be called by the GNS Desktop Manager before passing a notification to GNS clients (UIs). The GNS Desktop Manager will call this method and if any application returns true, the GNS Desktop Manager will assume that the application will handle the notification and will not pass it to clients.
  • specify an Interop popup method which should be called by GNS clients instead of displaying their own notifications;
  • specify an Interop detail method which should be called by GNS clients instead of displaying their own notification details view;
  • specify a list of Glue42 Actions associated with the notification which GNS clients can use to display buttons or a context menu with the actions applicable to a notification. Each action is tied to an Interop method which will be called when the action is executed.

Using Notifications in a Workflow

A mortgage specialist might be entering information about a mortgage in an application. This will create a server-side notification that in turn will be pushed to a mortgage support team. Then, the notification will be received by a team member, who will click on it and the "Mortgages" application will be automatically opened. The team member can then review and validate the information entered by the mortgage specialist.

All this becomes possible by assigning an Interop detail routing method to the notification so that the GNS Desktop Manager will call this method (registered by the "Mortgages" app) instead of showing the notification details.

Handler, Popup and Detail Methods

Handler Method

Signature:

bool HandleNotification(Notification notification)

If present, the method will be called by the GNS Desktop Manager when a notification arrives. If the method returns true (meaning "handled"), the notification will not be passed to generic GNS Clients (i.e. UIs).

Popup Method

Signature:

void PopupNotification(Notification notification)

Used to define a method which GNS Clients should call to display the notification as a popup/toast.

Detail Method

Signature:

void ShowNotificationDetails(Notification notification)

Used to define a method which should be called by GNS Clients to display the details of a notification (instead of doing that themselves). It can only be called from a GNS Client (UI/Viewer), either by clicking on the popup (toast) or double-clicking a notification in a notification list/history window.

Actions

A list of actions can be applied to a notification group, notification source or a particular notification instance. An action has a human-readable name, and a method name, which will be called when the action is performed by the user. The method parameters are macro-enabled and can cite the notification properties.

Generic GNS clients will merge the actions defined in the:

  • notification category
  • notification source
  • notification itself

The merging will be done in that order of precedence.

The GNS clients can then present the actions to the user in a suitable way (e.g., as hover buttons or a context menu). When a user clicks on an action, the GNS client will execute the corresponding Interop method. Actions can be optionally grouped in a pattern, which may be used by a GNS client to merge the actions under a menu tree or to group the actions in clusters.

glue.interop.invoke(
    "T42.GNS.Publish.RaiseNotification", {
        notification: {
            title: "Critical Alert",
            severity: "High",
            description: "Your computer will be restarted in 30 seconds",
            actions: [{ 
               name: "restart",
               description: "Initiate system restart.",
               displayName: "Restart"
            },
            { 
               name: "postpone",
               description: "Postpone system restart.",
               displayName: "Postpone"
            }]
        }
    })
    .then(() => console.log("Raised a notification"))
    .catch(console.error);

Notification Actions

Custom Notification UI

You can change the default notification UI by changing the GNS application configuration:

  • if you are running in local mode, go to %LOCALAPPDATA%\Tick42\GlueDesktop\config\apps\gns.json;
  • find the GNS application;
  • add a customProperties section (or update the existing one):
"customProperties": {
    "toastUrl": "https://enterprise-demos.tick42.com/gns-custom-toasts/",
    "width": 250,
    "height": 125,
    "count": 3
}

Custom Notification