0.0.2 • Published 6 months ago

@dallotech/nestjs-sparrow-sms v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Introduction

This is simple wrapper for Sparrow SMS. It supports sending SMS only, but later more will be added. Just ping me or open pull request and contribute :)

Installation

$ npm i --save @dallotech/nestjs-sparrow-sms 
$ yarn add @dallotech/nestjs-sparrow-sms 

Importing module Async

import { SparrowSmsModule } from 'nestjs-sparrow-sms';
@Module({
  imports: [
      SparrowSmsModule.registerAsync({
          imports: [ConfigModule],
          inject: [ConfigService],
          useFactory: (configService: ConfigService<AllConfig>) => ({
              identity: configService.get("----your key-----", {infer: true}),
              mode: configService.get("----your key-----", {infer: true}),
              token: configService.get("----your key-----", {infer: true}),
          })
      }),
  ],
  providers: [],
  exports: [],
})
export class YourModule {}

Calling Send Method to send SMS

import { SparrowSmsService,SparrowSmsRequestDto } from 'nestjs-sparrow-sms';

@Injectable()
export class YourService {
  constructor(private sparrowSmsService: SparrowSmsService) {}
    
    async anyCustomFunction(){
        //...your code
        const sparrowSmsRequestDto: SparrowSmsRequestDto = {
      to: 'SMS RECEIVING NUMBER',
      text: 'SMS MESSAGE'
    };
    await this.sparrowSmsService.send(sparrowSmsRequestDto);
  }
}

License

This package is MIT licensed.

0.0.2

6 months ago

0.0.1

6 months ago