The Notifications API allows plugins to register Notification Providers which have `sendNotification` and `resendNotification`. Each plugin can listen to any events transmittet over the event bus and the result of the notification send will be persisted in the database to allow for clear communications timeline + ability to resend notifications.
17 lines
380 B
JavaScript
17 lines
380 B
JavaScript
class UserSubscriber {
|
|
constructor({ sendgridService, eventBusService }) {
|
|
this.sendgridService_ = sendgridService
|
|
|
|
this.eventBus_ = eventBusService
|
|
|
|
this.eventBus_.subscribe("user.password_reset", async (data) => {
|
|
await this.sendgridService_.transactionalEmail(
|
|
"user.password_reset",
|
|
data
|
|
)
|
|
})
|
|
}
|
|
}
|
|
|
|
export default UserSubscriber
|