Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
node-sms-sdk
Advanced tools
Readme
Sdk for working with multiple sms gateway.
npm i --save node-sms-sdk
or
yarn add node-sms-sdk
then you use in your project
const nodeSmsSdk = require('node-sms-sdk')
/**
* @param sdk : The name of the sdk. This could be anything, except
* when using an internally shipped sdk like 'twilio' or 'infobip'.
* You can override any of the internally shipped ones with yours by calling this
* method and passing an adapter
* @param config : (object) the configuration needed by this sdk
* @param adapter : (module) the sdk's adapter. This is used when using an external sdk
**/
nodeSmsSdk.addConfig(sdk: string, config:object [, adapter]) : void
/**
* @param sdk : the name of the sdk
*
* @return : returns the config for that sdk, if not available, it
* returns all available config
**/
nodeSmsSdk.getConfig(sdk: string) : Object
/**
* @param sdk : the name of the sdk that you want to set as the
* default
**/
nodeSmsSdk.use(sdk: string) : void
/**
* @param sdk : the name of the sdk that you want to get
* @return : returns the instance of the raw sdk.
**/
nodeSmsSdk.getSdkInstance(sdk: string) : sdk
/**
* @param data : (object)
* data = {
* from: 'sender',
* to: 'recipient', //this could be an array
* body: 'message to be sent'
* }
* @return : Promise
**/
nodeSmsSdk.send(data: object) : Promise<any>
Building your own adapter is pretty easy and straight forward. Simply write a module that has the following exports. What to do when you're done??
module.exports = {
/**
* This takes a config object that it can use to initialize
* module
**/
loadConfig: (config: object) => {
},
/**
* Returns a tbe current instance of the adapter.
* Gives you access to the raw module by the provider
*
* @return adapter
**/
raw: () => {
},
/**
* This method should send a message and return a promise
*
* @param from: number or name sending the message
* @parm to: the number(s) you're sending the message to.
* This could also be an array
* @parm body: The message to be sent
**/
send: ({ from, to, body }) => {
}
}
//require module
const nodeSmsSdk = require('node-sms-sdk')
//add config for an sdk. twilio ships internally
nodeSmsSdk.addConfig('twilio',{
accountSid: 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
authToken: 'your_auth_token'
})
//use twilio as default
nodeSmsSdk.use('twilio')
//send message
nodeSmsSdk.send({
from: '+2348120725879',
to: '+23408040320343',
body: 'This works yay!!!'
}).then(console.log).catch(console.log)
FAQs
Sdk for working with multiple sms gateway.
The npm package node-sms-sdk receives a total of 0 weekly downloads. As such, node-sms-sdk popularity was classified as not popular.
We found that node-sms-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.