Notifications
5.24.0The Notifications API allows you to raise notifications, handle notification and action clicks via Interop methods, control the Notification Panel and subscribe for notification events.
The Notifications API is accessible through the glue.notifications
object.
APIobject
Description
Notifications API
Available since version Glue42 3.9Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
maxActions | number | The maximum number of notification actions that is supported. |
||
panel | NotificationPanelAPI | API for controlling the Notification Panel. Available since version Glue42 3.12.1 |
Methods
clearmethod
Signature
(id: string) => Promise<void>
Description
Clears a notification by ID.
Available since version Glue42 3.22
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | string | ID of the notification to clear. |
clearAllmethod
Signature
() => Promise<void>
Description
Clears all notifications.
Available since version Glue42 3.22
clearOldmethod
Signature
() => Promise<void>
Description
Clears all notifications in the Notification Panel that the user has already seen.
Available since version Glue42 3.22
clickmethod
Signature
(id: string, action?: string) => Promise<void>
Description
Clicks programmatically a notification or a notification action.
Available since version Glue42 3.22
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | string | ID of the notification to click. |
|
action | string | ID of the action to click. |
configuremethod
Signature
(options: Configuration) => Promise<void>
Description
Configures the global notification settings.
Parameters
Name | Type | Required | Description |
---|---|---|---|
options | Configuration | Object holding global notification settings. |
getConfigurationmethod
Signature
() => Promise<Configuration>
Description
Retrieves the current global notification settings.
getFiltermethod
Signature
() => Promise<NotificationFilter>
Description
Retrieves the current filter with apps allowed or not allowed to raise notifications.
listmethod
Signature
() => Promise<NotificationData[]>
Description
Retrieves a list of objects describing all available notifications.
onClosedmethod
Signature
(callback: (notification: { id: string; }) => void) => UnsubscribeFunction
Description
Notifies when a notification is closed.
Available since version Glue42 3.22
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (notification: { id: string; }) => void | Callback function for handling the event. |
onConfigurationChangedmethod
Signature
(callback: (config: Configuration, apps: number) => void) => UnsubscribeFunction
Description
Notifies when the global notification settings are changed.
Available since version Glue42 3.22
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (config: Configuration, apps: number) => void | Callback function for handling the event. |
onCounterChangedmethod
Signature
(callback: (info: { count: number; }) => void) => UnsubscribeFunction
Description
Notifies when the notification counter is changed.
Available since version Glue42 3.22
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (info: { count: number; }) => void | Callback function for handling the event. |
onDataChangedmethod
Signature
<T>(callback: (data: T) => void) => UnsubscribeFunction
Description
Notifies when the arbitrary data associated with the notification (available in the data
property of the notification) is changed.
Available since version Glue42 3.24
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (data: T) => void | Callback function for handling the event. |
onRaisedmethod
Signature
(callback: (notification: NotificationData) => void) => UnsubscribeFunction
Description
Notifies when a new notification is raised.
Available since version Glue42 3.22
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (notification: NotificationData) => void | Callback function for handling the event. |
onStateChangedmethod
Signature
(callback: (notification: { id: string; }, state: State) => void) => UnsubscribeFunction
Description
Notifies when the state of a notification is changed.
Available since version Glue42 3.22
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (notification: { id: string; }, state: State) => void | Callback function for handling the event. |
raisemethod
Signature
(notification: Glue42NotificationOptions) => Promise<Glue42Notification>
Description
Raises a new notification.
Parameters
Name | Type | Required | Description |
---|---|---|---|
notification | Glue42NotificationOptions | Object with options for the raised notification. |
setFiltermethod
Signature
(filter: NotificationFilter) => Promise<NotificationFilter>
Description
Sets a filter with apps allowed or not allowed to raise notifications.
Parameters
Name | Type | Required | Description |
---|---|---|---|
filter | NotificationFilter | Filter with names of apps allowed or not allowed to raise notifications. |
setStatemethod
updateDatamethod
Signature
(id: string, data: unknown) => Promise<void>
Description
Sets or updates the arbitrary data associated with the notification which is available in the data
property of the notification.
Available since version Glue42 3.24
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | string | ID of the notification whose data to update. |
|
data | unknown | New notification data. |
ActionEventobject
Description
Describes a notification action event.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
action | string | The name of the notification action executed by the user. |
Configurationobject
Description
Global notification settings.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
enable | boolean | If |
||
enableToasts | boolean | If |
||
sourceFilter | NotificationFilter | Filter with names of apps that are allowed or not allowed to raise notifications. |
||
toastExpiry | number | Interval in seconds after which the notification toasts will be hidden. |
||
toasts | { mode?: "single" | "stacked"; stackBy?: "severity" | "application"; } |
Glue42Notificationobject
Description
Object describing a raised notification.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
actions | Glue42NotificationAction[] | Array of objects describing the available notification actions. |
||
appIcon | string | Icon of the app that has raised the notification. |
||
appTitle | string | Title of the app that has raised the notification. |
||
close | () => void | Closes the notification. |
||
id | string | ID for the notification. |
||
instanceId | string | ID of the app instance that has raised the notification. |
||
onaction | (ev: ActionEvent) => any | Notifies when a notification action has been clicked. |
||
onclick | (ev: Event) => any | Notifies when the notification has been clicked. |
||
onclose | (ev: Event) => any | Notifies when the notification has been closed. |
||
onshow | (ev: Event) => any | Notifies when the notification has been shown. |
||
state | State | State of the raised notification. |
Glue42NotificationActionobject
Description
Object describing a notification action.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
action | string | Name of the notification action. |
||
icon | string | Icon for the notification action. |
||
interop | InteropActionSettings | Object with settings for invoking an Interop method when the notification action is clicked. |
||
title | string | Title of the notification action that will be used in the notification action button. |
Glue42NotificationOptionsobject
Description
Options for raising a notification.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
actions | Glue42NotificationAction[] | Array of objects describing notification actions. The notification actions will be displayed as buttons in the notification. |
||
badge | string | |||
body | string | |||
clickInterop | InteropActionSettings | Object with settings for invoking an Interop method when the notification is clicked. |
||
data | any | |||
dir | NotificationDirection | |||
icon | string | |||
id | string | Id for the notification. |
||
image | string | |||
lang | string | |||
panelExpiry | number | Interval in seconds after which the notification will be removed from the Notification Panel. |
||
renotify | boolean | |||
requireInteraction | boolean | |||
severity | "Low" | "Medium" | "High" | "Critical" | "None" | Severity of the notification. |
||
silent | boolean | |||
source | string | Can be used for overwriting the name of the actual notification source. |
||
state | State | "Active" | Notification state. |
|
tag | string | |||
timestamp | number | |||
title | string | Title for the notification. |
||
toastExpiry | number | Interval in seconds after which the notification toast will be hidden. |
||
type | "Notification" | "Alert" | Type of the notification. |
||
vibrate | VibratePattern |
InteropActionSettingsobject
Description
Object with settings for invoking an Interop method when a notification or a notification action is clicked.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
arguments | any | Object with arguments for the Interop method invocation. |
||
method | string | Name of the Interop method to invoke. |
||
target | "best" | "all" | Specifies which Interop servers to target when invoking the Interop method -
|
NotificationDataobject
Description
Object describing a notification.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
actions | Glue42NotificationAction[] | Array of objects describing notification actions. The notification actions will be displayed as buttons in the notification. |
||
appIcon | string | Icon of the app that has raised the notification. |
||
appTitle | string | Title of the app that has raised the notification. |
||
clickInterop | InteropActionSettings | Object with settings for invoking an Interop method when the notification is clicked. |
||
id | string | ID for the notification. |
||
instanceId | string | ID of the app instance that has raised the notification. |
||
panelExpiry | number | Interval in seconds after which the notification will be removed from the Notification Panel. |
||
severity | "Low" | "Medium" | "High" | "Critical" | "None" | Severity of the notification. |
||
source | string | Can be used for overwriting the name of the actual notification source. |
||
state | State | State of the raised notification. |
||
title | string | Title for the notification. |
||
toastExpiry | number | Interval in seconds after which the notification toast will be hidden. |
||
type | "Notification" | "Alert" | Type of the notification. |
NotificationFilterobject
Description
Filter with names of apps that are allowed or not allowed to raise notifications.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
allowed | string[] | Array of names of apps allowed to raise notifications. |
||
blocked | string[] | Array of names of apps not allowed to raise notifications. |
NotificationPanelAPIobject
Description
API for controlling the Notification Panel.
Available since version Glue42 3.12.1Methods
hidemethod
Signature
() => Promise<void>
Description
Hides the Notification Panel.
isVisiblemethod
Signature
() => Promise<boolean>
Description
Checks whether the Notification Panel is visible.
onVisibilityChangedmethod
Signature
(callback: (isVisible: boolean) => any) => UnsubscribeFunction
Description
Notifies when the visibility of the Notification Panel changes.
Available since version Glue42 3.22
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (isVisible: boolean) => any | Callback function for handling the event. |
showmethod
Signature
() => Promise<void>
Description
Shows the Notification Panel.
togglemethod
Signature
() => Promise<void>
Description
Toggles the visibility of the Notification Panel.
Stateenumeration
Description
Notification state.
"Active"
- based on configuration, the notification is either visible as a toast, or is raised only in the Notification Panel, but the user hasn't seen it yet. When the toast is hidden, the user clicks on the toast, or sees the notification in the Notification Panel, the state will change;"Acknowledged"
- the user has seen the notification in the Notification Panel;"Closed"
- the notification has either been closed from its "Close" button, or the user has clicked on it or on an action in it;"Stale"
- the time specified intoastExpiry
has elapsed;
- "Active"
- "Acknowledged"
- "Closed"
- "Stale"