This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@notifire/nest
TypeScript icon, indicating that this package has built-in type declarations

0.3.6-alpha.0 • Public • Published

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'
    });
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @notifire/nest

Weekly Downloads

1

Version

0.3.6-alpha.0

License

MIT

Unpacked Size

28.7 kB

Total Files

75

Last publish

Collaborators

  • novu-cliftonz
  • scopsy