Note: This article assumes that by "notification type", what is meant is referred
to as a trigger in the code base. There is a type field on the Notification model,
but that refers to how the notification is delivered (i.e. onsite or email). The
trigger field refers to the event that causes the user to be sent a notification.
trigger field on the Notification model in
Strapi admintrigger field on the NotificationConfigSetting modelnewTriggers
constant in the initialiseNotificationConfig() service function. The key is the new
identifier, and the value is an array of Notification.types that it should send to.GET /migration/update-notification-configs migration to give all existing users the
default settings for the new notification trigger.WithRequired<Notification, '[field names]'>. The field names should be strings
separated by pipes | (see AwardedBountyNotification for an example).imageUrl - The path for an image to be displayed next to the notification in the
drop down. This should be saved to the email folder in S3.text - The text that appears on the notificationtitle - The header that will be used in the email digestJust About Sandbox first and then pushed to Just About Production when it's ready.digestBypassTriggersTemplates
on the Notification service. The key should be the name of the trigger and the value should
be the name of the Postmark template.Notifications should be triggered within Strapi. To trigger the notification, call the
Notification.triggerNotifications()
service function.
The function takes the following parameters:
trigger - The indentifier set up for this notificationuser - The user instance to send the notification tosubject - A summary of the notification (does not appear to be used).params - An object of extra data to assign to the notification that can be used to
create the notification text. The following fields are permitted:
post - a Post objectbounty - a Bounty objectmembership - a Membership objectannouncement - an Announcement objectvars - a JSON-serializable object of arbitrary values that do not fit into the models listed above.