github novuhq/novu v0.3.3
V0.3.3 - The fancy frog release 🐸

latest releases: v0.24.1, v0.24.0, v0.23.0...
2 years ago

What's new?

Email attachments support

This incredible community effort started from @davidsoderberg who took on him to finalize the interface for the $attachments and later on all the community took the effort to update all of our 9 email providers.

So how this works?
The $attachment interface receives an array of attachment objects. Each attachment contains a file buffer, the mime type and the attachment name to be used.

const fileBuffer = fs.readFileSync('event.ics');
await notifire.trigger('test', {
    $user_id: '1234',
    $email: 'recipient@email.com',
    $attachments: [{
        file: fileBuffer,
        mime: 'text/plain',
        name: 'event.ics'
    }]
});

NestJS module

Created by @devblin you can now use notifire in your nestjs application easily by installing the @notifire/nest package.

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

Mail attachments contributors

New providers

Other changes

New Contributors in this version

Don't miss a new novu release

NewReleases is sending notifications on new releases.