adrashya-sms
v3.0.3
Published
A Multi SMS Gateways supported solution for Nodejs.
Downloads
3
Readme
Adrashya SMS
Priority Based Multi SMS Gateways supported. The list of supported SMS Gateways is here
- Kaleyra
- Innovis Solutions
- Uengage
- Bulk Software
Installation
Use the package manager npm to install adrashya-sms.
npm install adrashya-sms
Usage
# update .env with these keys
# For Kaleyra Gateway
KALEYRA_API_KEY='YOUR API KEY'
KALEYRA_SENDER_ID='YOUR SENDER ID'
KALEYRA_TEMPLATE_ID='YOUR TEMPLATE ID'
KALEYRA_SOURCE='API'
KALEYRA_TYPE='DEFAULT'
KALEYRA_SENDER='Your Sender'
# For Innovis Gateway
INNUVIS_API_KEY='YOUR API KEY'
INNUVIS_SENDER_ID='YOUR SENDER ID'
INNUVIS_TEMPLATE_ID='YOUR TEMPLATE ID'
INNUVIS_ROUTE='2'
INNUVIS_CHANNEL='Trans'
INNUVIS_PEID='Your PeID'
# For Uengage Gateway
UENGAGE_API_KEY='YOUR API KEY'
UENGAGE_SENDER_ID='YOUR SENDER ID'
UENGAGE_TEMPLATE_ID='YOUR TEMPLATE ID'
const SMS = require('adrashya-sms');
const sms = new SMS();
async function sendSms(){
sms.priority(['kaleyra', 'innovis', 'uengage']);
sms.to(<10 digit mobile no>);
// setting kaleyra params
sms.kaleyra().message('Your OTP is 123456.');
// setting innovis params
sms.innovis().message('Your OTP is 123456.');
// setting uengage params
sms.uengage().params(['123456']);
const response = await sms.send();
if(response.success){
// do stuff if message sent
console.log(response.message);
}else{
// do stuff if message failed
console.log(response.message);
}
}
Kaleyra (Parameters and Variables)
- sms.kaleyra().message(); // required ( similar to template )
- sms.kaleyra().apiKey(); // optional if KALEYRA_API_KEY is set in env
- sms.kaleyra().senderId(); // optional if KALEYRA_SENDER_ID is set in env
- sms.kaleyra().templateId(); // optional if KALEYRA_TEMPLATE_ID is set in env
- sms.kaleyra().type(); // optional if KALEYRA_TYPE is set in env
- sms.kaleyra().sender(); // optional if KALEYRA_SENDER is set in env
Innuvis (Parameters and Variables)
- sms.innuvis().message(); // required ( similar to template )
- sms.innuvis().apiKey(); // optional if INNUVIS_API_KEY is set in env
- sms.innuvis().senderId(); // optional if INNUVIS_SENDER_ID is set in env
- sms.innuvis().templateId(); // optional if INNUVIS_TEMPLATE_ID is set in env
Uengage (Parameters and Variables)
- sms.uengage().params([]); // required ( params for template )
- sms.uengage().apiKey(); // optional if UENGAGE_API_KEY is set in env
- sms.uengage().senderId(); // optional if UENGAGE_SENDER_ID is set in env
- sms.uengage().templateId(); // optional if UENGAGE_TEMPLATE_ID is set in env
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.