Skip to main content
Version: v5.1

Notification log

Overview#

Notifications are read-only entities which are are created when a notification is about to be sent to a given subscription. The status of the notification is updated in the notification log after the notification is sent, or if any error occurs.

This page describes the properties involved in the notification log and lists some API calls you can make to query notifications.

Notification properties#

Each notification entry in the notificiation log will have the following properties:

  • _namespaces: A string array, which will contain a single item, which is the owning namespace for this notification, the user querying must have have the read permission in this namespace for the IRN: `notificationsvc:notification:*``
  • _subscription._id: The ID of the subscription to which the notification was sent.
  • _trigger._id: The ID of the trigger that caused this notification.
  • _owner._irn: The IRN of the owning user. This will only be present when the subscription is of type DEVICE.
  • _template._id: The ID of the template that was used to generate the notification. This will only be present when the subscription is of type DEVICE.
  • _sender._id: The ID of the sender that was used to send the notification. This will only be present when the subscription is of type DEVICE.
  • _transport: The device transport type. This will only be present when the subscription is of type DEVICE.
  • _requestId: The request ID that originated this notification.
  • _eventId: The event ID that originated this notification. This will only be present when the trigger is of type EVENT.
  • _status: The status of the notification. It will have one of the following values:
    • SENDING: The notification is about to be sent
    • SENT: The notification was sent, and no errors are reported
    • ERROR: The notification failed
    • SKIPPED: The notification was not sent, because it failed rate limiting (See Rate Limiting page)

API examples#

How to list notifications#

To list notifications, you must provide a query. The query must include at least, a set of namespaces from which the calling user has READ permission, or an owner that matches the current user.

To query for notifications in your project, refer to the sample code below.

const notifications = await IafNotification.listNotifications({   namespaces: project._namespaces}, ctx);

To query for your own notifications, refer to the sample code below.

const notifications = await IafNotification.listNotifications({   owner: {      irn: "passportsvc:user:<user id>"   }}, ctx);

The following query properties are also supported:

  • namespaces
  • owner.irn
  • subscription.id
  • trigger.id
  • template.id
  • sender.id
  • transport
  • requestId
  • eventId