@jianghohwason/nt-addon-ali-sms
v0.0.1
Published
The aliCould SMS api addon for notadd application
Downloads
4
Readme
nest 阿里云短信插件
基于 nest 封装的 阿里云短信 API
安装
npm install @huazai5m/nt-addon-pay
配置 PayAddon
import { Module } from '@nestjs/common';
import { AliSMSAddon } from '@jianghohwason/nt-addon-ali-sms';
@Module({
imports: [
AliSMSAddon.forRoot({
accessKeyId: 'accessKeyId',
accessKeySecret: 'accessKeySecret',
endpoint: 'https://dysmsapi.aliyuncs.com',
apiVersion: '2017-05-25',
}),
],
})
export class ApplicationModule {}
使用 SMS 插件
import { Injectable, Inject } from '@nestjs/common';
import { AliSMSService } from '@jianghohwason/nt-addon-ali-sms';
@Injectable()
export class TestPay {
constructor(@Inject(AliSMSService) private readonly aliSMSService: AliSMSService) {}
async send() {
const res: any = await aliSMSService.sendSms({
PhoneNumbers: 'PhoneNumbers',
SignName: 'SignName',
TemplateCode: 'TemplateCode',
TemplateParam: JSON.stringify({ customer: '开发者' }),
});
console.log('res', res);
}
}