Skip to main content

SMS usage

Register SmsModule

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 {}

Send an SMS

sendAsync parameters

SmsService.sendAsync(args) accepts the following fields:

FieldTypeRequiredNotes
countryCodestring✅ YesCountry dialing code (e.g. "+90").
phoneNumberstring✅ YesRecipient phone number (without country code).
messagestring✅ YesSMS text content.
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',
});
}
}