var ebulksms =require('ebulksms')(EBULKSMS_USERNAME,EBULKSMS_APIKEY,{ senderId:SENDER_ID/* Optional. Default 'EbulkSMS' */});
Send SMS
ebulksms.send('2348118......','This is a test message','my_generated_unique_id',{
flash:false,// (Optional) Default false
senderId:'kb'// (Optional) This will override SENDER_ID if set
})
.then(function(response){
// Was successful
console.log(response);
/*
Sample response
{
"response": {
"status": "STATUS_STRING",
"totalsent": "<number of recipients>",
"cost": "<units charged>"
}
}
*/
})
.catch(function(error){
// Something happened
console.log(error);
/*
{
"response": {
"status": "STATUS_STRING",
"totalsent": "0",
"cost": "0"
}
}
*/
})
The first parameter can also be an array of objects in the form [{ recipient: '2348181......', messageId: '101292'}, ...]. Here messageId is optional as well and will be autogenerated if not provided