An addon/plugin package to provide InfoBip single/bulk SMS/Voice/WebRTC services in AdonisJS 4.0+
Install from the NPM Registry
$ adonis install adonisjs-infobip
Import and use
'use strict'
const Infobip = use('InfoBip')
class MessageController {
constructor(User){
this.user = User
}
static get inject(){
return [
'App/Models/User'
]
}
async sendOneSms({ request, response }){
let user = await this.user.find(1) // get user from database
let response = await Infobip.sendSMS({
messages: [{
destinations: [{
to: String(user.phone_number)
}],
from:"MESSANGER-NG",
text:`Hello ${user.full_name}, Happy birthday!`
}]
})
console.log("Bulk ID: ", response.body.bulkId)
return response.status(200).json({
status: 'success',
data: `Message sent to ${user.full_name}`
})
}
}
module.exports = MessageController
MIT
npm i
npm run lint
npm run test
See the CONTRIBUTING.md file for info