SMS kullanımı
SmsModule kaydı
app.module.ts
import { Module } from '@nestjs/common';
import { SmsModule, SmsProvider } from 'nestjs-notification-module';
@Module({
imports: [
SmsModule.register({
isGlobal: true,
provider: SmsProvider.MUTLUCELL,
username: 'mutlucell-user',
password: 'mutlucell-pass',
originator: 'MYBRAND',
}),
],
})
export class AppModule {}
SMS gönder
sendAsync parametreleri
SmsService.sendAsync(args) aşağıdaki alanları alır:
| Alan | Tip | Zorunlu | Notlar |
|---|---|---|---|
countryCode | string | ✅ Evet | Ülke kodu (örn. "+90"). |
phoneNumber | string | ✅ Evet | Alıcı telefon numarası (ülke kodu hariç). |
message | string | ✅ Evet | SMS metni. |
sms.service.ts
import { Injectable } from '@nestjs/common';
import { SmsService } from 'nestjs-notification-module';
@Injectable()
export class SmsAppService {
constructor(private readonly sms: SmsService) {}
async sendOtp(phoneNumber: string) {
return this.sms.sendAsync({
countryCode: '+90',
phoneNumber,
message: 'Your code is 1234',
});
}
}