9.0.5 • Published 1 year ago

@doracoder/fcm-nestjs v9.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

This project forked from CostianuRazvan/nestjs-fcm

Installation

npm install --save @doracoder/fcm-nestjs

FcmModule

To user FcmService you must add the module first. The FcmModule has a @Global() attribute so you should only import it once.

import { Module } from '@nestjs/common';
import { FcmModule } from '@doracoder/fcm-nestjs';
import * as path from 'path';

@Module({
  imports: [
    FcmModule.forRoot({
      firebaseSpecsPath: path.join(__dirname, '../firebase.spec.json'),
    }),
  ],
  controllers: [],
})
export class AppModule {}

FcmService use firebase.spec.json file to send notifications using firebase-admin dependency.

@Injectable()
export class SampleService {
  constructor(private readonly fcmService: FcmService) {}

  async sendToDevices() {
    await this.fcmService.sendNotification([
      'device_token_1',
      'device_token_2',
      ]
      payload,
      silent,
    );
  }

  async sendToTopic(topic: string) {
    await this.fcmService.sendToTopic(
      topic,
      payload,
      silent,
    );
  }
}

Change Log

See Changelog for more information.

Contributing

Contributions welcome! See Contributing.

Author

Tran Quy

License

Licensed under the MIT License - see the LICENSE file for details.

9.0.5

1 year ago

0.5.0

2 years ago

0.6.0

2 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago