gamanetsms
v1.0.10
Published
API para el envio de mensajes de texto SMS
Downloads
3
Readme
Quickstart
A sms module to send sms text ...
1. Install
npm install gamanetsms
2. Credentials (ES6 module syntax)
const GamanetSMS = require("gamanetsms");
const apicard = process.env.GAMANET_APICARD; // Your Apicard
const apikey = process.env.GAMANET_APIKEY; // Your Apikey
const smstype = "0";
let gamanet = new GamanetSMS(apicard,apikey,smstype);
3. Send SMS
Example 1, simple message
const resp = gamanet.smssend("519000000000","hi your code is 86345");
resp.then(result => {
if(result.error){
console.log(result.message);
}else{
console.log(result.data);
}
});
Example 2, attach image
const resp = gamanet.smssend("519000000000","hi attach image!","./public/files/logo_gama.png");
resp.then(result => {
if(result.error){
console.log(result.message);
}else{
console.log(result.data);
}
});
Example 3, send bulk sms
let messages = [];
messages.push({smsnumber:"51900000000",smstext:"hi, first sms",messageid:"1"});
messages.push({smsnumber:"752853422",smstext:"hi, second sms",messageid:"2"});
messages.push({smsnumber:"219524334",smstext:"hi, any sms",messageid:"3"});
const resp = gamanet.smsbulk(messages);
resp.then(result => {
if(result.error){
console.log(result.message);
}else{
console.log(result.data);
}
});
4. Report sms
Example, get info.
const messageid = "000001";
const resp = gamanet.reports(messageid);
resp.then(result => {
if(result.error){
console.log(result.message);
}else{
console.log(result.data);
}
});
5. Balance
Example, get balance
const resp = gamanet.smsbalance();
resp.then(result => {
if(result.error){
console.log(result.message);
}else{
console.log(result.data);
}
});
6. Generate PIN Code 2FA
Example, Generate Code
const number = "51900000000";
const applicationid = "123445"; // your aplicationid APP
const pinplaceholder = "CODE"; // Replace in text
const pinlength = "4";
const pintype = "alpha"; // alpha, numeric, alphanumeric
const text = "code is CODE"; //OK
const fail2voice = "0";
const resp = gamanet.sendpin(number,applicationid,pinplaceholder,pinlength,pintype,text,fail2voice);
resp.then(result => {
if(result.error){
console.log(result.message);
}else{
console.log(result.data);
}
});
7. Verification PIN Code 2FA
Example,
const applicationid = "123445"; // your aplicationid APP
const pin = "3450";
const resp = gamanet.verifypin(pin,applicationid);
resp.then(result => {
if(result.error){
console.log(result.message);
}else{
console.log(result.data);
}
});