Skip to content

recepkefelii/nestjs-netgsm-client

 
 

Repository files navigation

Nestjs Netgsm Client

Netgsm client for Netgsm.

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Halil Safa SAĞLIK - @ogeday26 - safa@rubiklabs.com Project Link: https://github.com/rubiklabs/nestjs-netgsm-client


To see all packages developed by Rubiklabs, you can check here

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 77.6%
  • JavaScript 21.2%
  • Shell 1.2%