0.3.6-alpha.0 • Published 2 years ago
@notifire/nest v0.3.6-alpha.0
NestJS Module Wrapper
A NestJS module wrapper for @notifire/core
Usage
Initializing module with templates and providers:
import { NotifireModule } from "@notifire/nest";
@Module({
imports: [
NotifireModule.forRoot({
providers: [
new SendgridEmailProvider({
apiKey: process.env.SENDGRID_API_KEY,
from: 'sender@mail.com',
}),
],
templates: [
{
id: 'password-reset',
messages: [
{
subject: 'Your password reset request',
channel: ChannelTypeEnum.EMAIL,
template: `
Hi {{firstName}}!
To reset your password click <a href="{{resetLink}}">here.</a>
`,
},
],
},
],
}),
],
})
Using notifire's singleton service in other services and modules:
import { Injectable, Inject } from '@nestjs/common';
import { NotifireService } from '@notifire/nest';
@Injectable()
export class UserService {
constructor(private readonly notifire: NotifireService) {}
async triggerEvent() {
await this.notifire.trigger('password-reset', {
$email: 'reciever@mail.com',
$user_id: 'id'
});
}
}
0.3.6-alpha.0
2 years ago
0.3.4
2 years ago
0.3.3
2 years ago
0.3.2-alpha.5
2 years ago
0.3.2-alpha.4
2 years ago
0.3.2-alpha.3
2 years ago
0.3.2-alpha.0
2 years ago