Package Exports
- infobip-nodejs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (infobip-nodejs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Infobip
A NodeJS Wrapper for InfoBip
Overview
This project provides an easy-to-use object-oriented API to access endpoints delineated at https://dev.infobip.com/getting-started
Installation
Install from the NPM Registry
npm i --save infobip-nodejs
Usage
let InfoBip = require('infobip-nodejs')
let APIKEY = '1IkXmSWOlE4y9Inhgyd6g5f2R7'
const environment = process.env.NODE_ENV
const isProduction = (environment === 'production')
const infobip = new InfoBip(APIKEY, isProduction, {
authType:'basic',
username:'user', // Infobip Username used for registration
password:'*******', // Infobip Password used for registration
encrypted:false
})
/*
Send SMS to two mobile numbers
- NB: make sure the Sender ID is registred with infobip before use
*/
const promise = infobip.sendSMS({
from: "YourCompanyName", // Sender ID
to: ['2348164422256', '2347039664638'], // MTN Numbers
text: 'Dear Customer, Thanks for registering with our service.'
})
promise.then( response => {
var data = response.body
}).catch( error => {
console.error(error)
})
/* Create an async express middleware for infobip */
async function infobipMiddleware(req, res, next){
const response = await infobip.numbers({
limit: 5, page: 0, number: '447860041117'
})
req.numbers = {
numberCount:response.body.numberCount
}
next()
}
API Resources
- infobip.sendSMS()
- infobip.sendSMSBulk()
- infobip.sendVoice()
- infobip.sendVoiceBulk()
- infobip.numbers()
- infobip.getNumber()
- infobip.purchaseNumber()
- infobip.getSMSDeliveryReports()
License
MIT
Credits
Contributing
See the CONTRIBUTING.md file for info