The Voxbone VoxSMS module enables you to send/receive SMS and delivery reports from Voxbone numbers.
To install the Voxbone VoxSMS module and its dependencies, simply run the following command:
npm install voxbone-voxsms
-
Add the dependency to your application
var Voxbone = require('voxbone');
-
Add your credentials
var api_login = 'login'; var api_password = 'password';
-
Create a new Voxbone object
var voxbone = new Voxbone({ apiLogin: api_login, apiPassword: api_password });
-
Add your parameters to send a message
var from = "+3228080438"; //a Voxbone number enabled for VoxSMS (format: +3200000) var to = "3222222222"; //the destination number (format: 3200000) var msg = "your message"; var dr = "none"; //Delivery reports - Accepted values: success, failure, all, none
-
Generate a fragmentation reference for your sms
This will be used in case your message is too long.
var fragref = voxbone.createFragRef();
-
Send SMS with the parameters configured in step 1
voxbone.sendSMS(to, from, msg, fragref, dr);
Available functions:
-
Sends an SMS with the parameters configured
voxbone.sendSMS(to, from, msg, fragref, dr);
-
Generates a random fragmentation reference used for long messages
voxbone.createFragRef();
-
Generates a transaction ID to be sent back with your 200OK response when receiving a message.
voxbone.createTransId();
-
Sends a delivery report to Voxbone when your application receives a message
voxbone.sendDeliveryReport();