@rubiklabs/nestjs-netgsm-client
v1.1.1
Published
Netgsm client for NestJS
Downloads
64
Readme
Features
Sending Sms via Netgsm
Installation
Yarn
yarn add @rubiklabs/nestjs-netgsm-client
NPM
npm install @rubiklabs/nestjs-netgsm-client --save
Getting Started
To use Netgsm client we need to register module for example in app.module.ts
import { Module } from '@nestjs/common';
import { NetgsmModule } from '@rubiklabs/nestjs-netgsm-client';
@Module({
imports: [
NetgsmModule.register({
username: 'username',
password: "password,
header: "header,
})
})
export class AppModule {}
If you are using the @nestjs/config
package from nest, you can use the ConfigModule
using the registerAsync()
function to inject your environment variables like this in your custom module:
import { Module } from '@nestjs/common';
import { NetgsmModule } from '@rubiklabs/nestjs-netgsm-client';
import { ConfigModule, ConfigService } from '@nestjs/config';
@Module({
imports: [
NetgsmModule.registerAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory(configService: ConfigService) {
return {
isGlobal: true,
username: configService.get('netgsm_username'),
password: configService.get('netgsm_password'),
header: configService.get('netgsm_header'),
}
},
})
],
providers: [],
exports: [],
})
export class AppModule {}
After registration netgsm connection should be complete and ready to use.
Example usage in service.
import { Injectable } from '@nestjs/common';
import { NetgsmModule } from 'nestjs-netgsm-client';
@Injectable()
export class ContentService {
constructor(private readonly netgsmService: NetgsmService) {}
async sendSms() {
return await this.netgsmService.sendSms('phone_number', 'Hello World!');
}
}
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Halil Safa SAĞLIK - @ogeday26 - [email protected] Project Link: https://github.com/rubiklabs/nestjs-netgsm-client