Skip to main content

Register a notifications platform

In Notification Center v2 or later (Here Core UI Components 15 or later), the register() function signature is required, and its signature is modified. The modified function lets you control when Notification Center starts on users' desktops.

In Notifications v2.4 or later (Here Core UI Components 17.2 or later), you can host Notification Center on your own server.

How it works

In earlier versions, the register() function in @openfin/workspace/notifications let you register your Here Core UI platforms. It is now modified to take a NotificationsRegisterOptions parameter instead of a platform. The previous function signature is deprecated, and will no longer be supported in a future release.

WARNING: The openfin-notifications package is deprecated, and will no longer be supported in a future release.

To host on your own server, you provide your manifest information in a notificationsCustomManifest property of the NotificationsRegisterOptions object. You provide the location of Notification Center in the manifest. This feature is available only in Notifications v2.4 or later (Here Core UI Components 17.2 or later), with Runtime v34 or later.

We recommend working with the default Runtime version for your version of Notification Center. This is the version we test against.

How to do it

Host on your server (optional)

Get the Notification Service package:

  1. Download the Notifications Service package from the Here™ Versions page.

  2. Unzip the package, and host the contents over HTTPS on your server.

  3. In your manifest, include the location of the provider.html file that's included in the package. You should also include the security realm. The manifest should include settings that look something like the following example, which is modeled on the manifest for Notification Center hosted by Here™. Make sure to replace all values with values for your environment:

    {
    ...
    "offlineAccess": true,
    "startup_app": {
    "name": "Private-Virtual-Notifications-2",
    "description": "Here Core UI Notification Center",
    "url": "https://PRIVATE_SERVER/NOTIFICATIONS_SERVICE_SUBDOMAIN/provider.html",
    "uuid": "MANIFEST_UUID",
    ...
    }
    },
    "runtime": {
    ...
    "arguments": "--security-realm=[REALMID]",
    "version": "34.118.78.80",
    ...
    },
    "workspace": {}
    }

    You can also get the default manifest from the Here™ CDN, at https://cdn.openfin.co/services/openfin/notifications/VERSION/app.json and modify only the URL and UUID if you don't require additional customization. This approach guarantees the correct Runtime version.

Register platform

import { register, create } from "@openfin/workspace/notifications";
import type { NotificationsRegisterOptions } from '@openfin/workspace/notifications';

// define notifications provider -- a Here Core UI platform in this case
const examplePlatform: options =
{
notificationsPlatformOptions:
{
id: "UNIQUE_PROVIDER_ID",
title: "Custom Notification Platform",
icon: "https://example.com/favicon.ico",
},
// optional, provide only if you host Notification Center on your CDN
notificationsCustomManifest:
{
// replace these values with your own, from the application manifest
manifestUrl: URL_OF_CUSTOM_MANIFEST,
// UUID cannot be `notifications-service`, which is the value of the service hosted by Here™
// MUST match the UUID associated with `manifestUrl`
manifestUuid: UUID_OF_CUSTOM_MANIFEST
}
};

// explicitly register defined platform
// you can also pass the register() function without options
register(examplePlatform);

You can continue to work with the previous approach, which starts Notification Center automatically, but it is now deprecated.

import { create } from "openfin-notifications";

// create notification definitions