Skip to main content
Version: v5.0

IafNotification

Use the IafNotification API to create and manage notifications and associated resources

createDevice

Creates a notification device

ParameterRequiredTypeDescription
deviceYesNotificationDevicePass the device to create
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcCreateOptionsService specific options.
Returns

Promise<NotificationDevice> - Created device

Examples
const subscriber =
await IafNotification.createDevice(
{
_owner: {
_irn: "passportsvc:user:myuserid"
},
_transport: "EMAIL",
_address: "test@example.com"
},
ctx
);

createGroup

Creates a notification group

ParameterRequiredTypeDescription
groupYesNotificationGroupPass the group to create
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcCreateOptionsService specific options.
Returns

Promise<NotificationGroup> - Created group

Examples
const group =
await IafNotification.createGroup(
{
_name: "System",
_description: "System notification group"
_namespaces: project._namespaces
},
ctx
);

createSender

Creates a notification sender

ParameterRequiredTypeDescription
senderYesNotificationSenderPass the sender to create
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcCreateOptionsService specific options.
Returns

Promise<NotificationSender> - Created sender

Examples
const sender =
await IafNotification.createSender(
{
_name: "System",
_description: "System notification sender"
_namespaces: project._namespaces
},
ctx
);

createSubscription

Creates a notification subscription

ParameterRequiredTypeDescription
subscriptionYesNotificationSubscriptionPass the subscription to create
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcCreateOptionsService specific options.
Returns

Promise<NotificationSubscription> - Created subscription

Examples
const subscription =
await IafNotification.createSubscription(
{
_namespaces: project._namespaces,
_group: {
_id: "<group id>"
},
_device: {
_id: "<device id>"
}
},
ctx
);

createTemplate

Creates a notification template

ParameterRequiredTypeDescription
templateYesNotificationTemplatePass the template to create
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcCreateOptionsService specific options.
Returns

Promise<NotificationTemplate> - Created template

Examples
const template =
await IafNotification.createTemplate(
{
_namespaces: project._namespaces,
_transport: "EMAIL",
_format: "VELOCITY",
},
ctx
);

createTrigger

Creates a notification trigger

ParameterRequiredTypeDescription
triggerYesNotificationTriggerPass the template to create
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcCreateOptionsService specific options.
Returns

Promise<NotificationTrigger> - Created trigger

Examples
const trigger =
await IafNotification.createTrigger(
{
_namespaces: project._namespaces,
_type: "EVENT"
},
ctx
);

deleteDevice

Deletes a notification device

ParameterRequiredTypeDescription
idYesStringThe id of the device to delete
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcDeleteOptionsService specific options.
Returns

Promise<void> - Empty promise

Examples
await IafNotification.deleteDevice(
deviceId,
ctx
);

deleteGroup

Deletes a notification group

ParameterRequiredTypeDescription
idYesStringThe id of the group to delete
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcDeleteOptionsService specific options.
Returns

Promise<void> - Empty promise

Examples
await IafNotification.deleteGroup(
groupId,
ctx
);

deleteSender

Deletes a notification sender

ParameterRequiredTypeDescription
idYesStringThe id of the sender to delete
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcDeleteOptionsService specific options.
Returns

Promise<void> - Empty promise

Examples
await IafNotification.deleteSender(
senderId,
ctx
);

deleteSubscription

Deletes a notification subscription

ParameterRequiredTypeDescription
idYesStringThe id of the subscription to delete
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcDeleteOptionsService specific options.
Returns

Promise<void> - Empty promise

Examples
await IafNotification.deleteSubscription(
subscriptionId,
ctx
);

deleteTemplate

Deletes a notification template

ParameterRequiredTypeDescription
idYesStringThe id of the template to delete
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcDeleteOptionsService specific options.
Returns

Promise<void> - Empty promise

Examples
await IafNotification.deleteTemplate(
templateId,
ctx
);

deleteTrigger

Deletes a notification trigger

ParameterRequiredTypeDescription
idYesStringThe id of the trigger to delete
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcDeleteOptionsService specific options.
Returns

Promise<void> - Empty promise

Examples
await IafNotification.deleteTrigger(
triggerId,
ctx
);

getDevice

Gets a notification device

ParameterRequiredTypeDescription
idYesStringThe id of the device to get
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcGetOptionsService specific options.
Returns

Promise<NotificationDevice> - The subscriber

Examples
const subscriber =
await IafNotification.getDevice(
deviceId,
ctx
);

getGroup

Gets a notification group

ParameterRequiredTypeDescription
idYesStringThe id of the group to get
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcGetOptionsService specific options.
Returns

Promise<NotificationGroup> - Updated group

Examples
const group =
await IafNotification.getGroup(
groupId,
ctx
);

getSender

Gets a notification sender

ParameterRequiredTypeDescription
idYesStringThe id of the sender to get
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcGetOptionsService specific options.
Returns

Promise<NotificationSender> - The sender

Examples
const sender =
await IafNotification.getSender(
senderId,
ctx
);

getSubscription

Gets a notification subscription

ParameterRequiredTypeDescription
idYesStringThe id of the subscription to get
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcGetOptionsService specific options.
Returns

Promise<NotificationSubscription> - The subscription

Examples
const subscription =
await IafNotification.getSubscription(
subscriptionId,
ctx
);

getTemplate

Gets a notification template

ParameterRequiredTypeDescription
idYesStringThe id of the template to get
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcGetOptionsService specific options.
Returns

Promise<NotificationTemplate> - The template

Examples
const template =
await IafNotification.getTemplate(
templateId,
ctx
);

getTrigger

Gets a notification trigger

ParameterRequiredTypeDescription
idYesStringThe id of the trigger to get
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcGetOptionsService specific options.
Returns

Promise<NotificationTrigger> - The template

Examples
const trigger =
await IafNotification.getTrigger(
triggerId,
ctx
);

listDevices

List notification devices

ParameterRequiredTypeDescription
queryNoNotificationDeviceQueryThe query.
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcListOptionsService specific options.
Returns

Promise<Page<NotificationDevice>> - Matched devices

Examples
const subscribers =
await IafNotification.listDevices(
{
owner: {
irn: "passportsvc:user:myuserid"
},
},
ctx
);

listGroups

List notification groups

ParameterRequiredTypeDescription
queryNoNotificationGroupQueryThe query.
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcListOptionsService specific options.
Returns

Promise<Page<NotificationGroup>> - Updated group

Examples
const groups =
await IafNotification.listGroups(
{
namespaces: ["ns1"]
},
ctx
);

listNotifications

List notification history

ParameterRequiredTypeDescription
queryNoNotificationNotificationQueryThe query.
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcListOptionsService specific options.
Returns

Promise<Page<NotificationNotification>> - Matched triggers

Examples
const notifications =
await IafNotification.listNotifications(
{
namespaces: ["ns1"],
owner: {
irn: "passportsvc:user:myuserid"
},
},
ctx
);

listSenders

List notification senders

ParameterRequiredTypeDescription
queryNoNotificationSenderQueryThe query.
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcListOptionsService specific options.
Returns

Promise<Page<NotificationSender>> - Matched senders

Examples
const senders =
await IafNotification.listSenders(
{
namespaces: ["ns1"]
},
ctx
);

listSubscriptions

List notification subscriptions

ParameterRequiredTypeDescription
queryNoNotificationSubscriptionQueryThe query.
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcListOptionsService specific options.
Returns

Promise<Page<NotificationSubscription>> - Matched subscriptions

Examples
const subscriptions =
await IafNotification.listSubscriptions(
{
namespaces: ["ns1"]
},
ctx
);

listTemplates

List notification templates

ParameterRequiredTypeDescription
queryNoNotificationTemplateQueryThe query.
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcListOptionsService specific options.
Returns

Promise<Page<NotificationTemplate>> - Matched templates

Examples
const templates =
await IafNotification.listTemplates(
{
namespaces: ["ns1"]
},
ctx
);

listTriggers

List notification triggers

ParameterRequiredTypeDescription
queryNoNotificationTriggerQueryThe query.
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcListOptionsService specific options.
Returns

Promise<Page<NotificationTrigger>> - Matched triggers

Examples
const triggers =
await IafNotification.listTriggers(
{
namespaces: ["ns1"]
},
ctx
);

updateGroup

Updates a notification group

ParameterRequiredTypeDescription
idYesStringThe id of the group to update
groupYesNotificationGroupValues to update
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcUpdateOptionsService specific options.
Returns

Promise<NotificationGroup> - Updated group

Examples
const group =
await IafNotification.updateGroup(
groupId,
{
_description: "System notification group"
},
ctx
);

updateSender

Updates a notification sender

ParameterRequiredTypeDescription
idYesStringThe id of the sender to update
senderYesNotificationSenderValues to update
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcUpdateOptionsService specific options.
Returns

Promise<NotificationSender> - Updated sender

Examples
const sender =
await IafNotification.updateSender(
senderId,
{
_description: "System notification sender"
},
ctx
);

updateTemplate

Updates a notification template

ParameterRequiredTypeDescription
idYesStringThe id of the template to update
templateYesNotificationTemplateValues to update
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcUpdateOptionsService specific options.
Returns

Promise<NotificationTemplate> - Updated template

Examples
const template =
await IafNotification.updateTemplate(
templateId,
{
_body: "template body"
},
ctx
);

updateTrigger

Updates a notification trigger

ParameterRequiredTypeDescription
idYesStringThe id of the trigger to update
triggerYesNotificationTriggerValues to update
ctxNoCtxContext, such as authorization token requirements, namespaces, or session storage.
optionsNoNotificationSvcUpdateOptionsService specific options.
Returns

Promise<NotificationTrigger> - Updated trigger

Examples
const trigger =
await IafNotification.updateTrigger(
triggerId,
{
},
ctx
);