The NextSMS SDK allows developers to easily integrate NextSMS solutions in their Javascript code, and build robust applications and software.
Take a look at the SDK docs here.
NOTE:
> Test Mode ONLYSingle destination
andMultiple destinations
APIs support testing mode.
yarn add @nextsms/js-client
# or
npm i @nextsms/js-client
import NextSMS from '@nextsms/js-client';
// Populate the credentials
const username = 'username';
const password = 'password';
const apiKey = null';
// Initiate with credentials
let nextsms = new NextSMS({ username, password, apiKey, environment: 'testing' });
const data = {
from: 'NEXTSMS',
to: '255123456789',
text: 'Hello World',
};
// Send the sms
nextsms
.singleDestination(data)
.then(data => {
// Print results
console.log(data);
})
.catch(error => {
console.log('error: ' + error);
});
import NextSMS from '@nextsms/js-client';
// Populate the credentials
const username = null;
const password = null;
const apiKey = 'yourBase64Key'; // this is generated on https://www.blitter.se/utils/basic-authentication-header-generator/ as mentioned on nextsms api documentation.
// Initiate with credentials
let nextsms = new NextSMS({ username, password, apiKey, environment: 'testing' });
const data = {
from: 'NEXTSMS',
to: '255123456789',
text: 'Hello World',
};
// Send the sms
nextsms
.singleDestination(data)
.then(data => {
// Print results
console.log(data);
})
.catch(error => {
console.log('error: ' + error);
});
yarn test
If you have a feature request or you encounter a bug, please file an issue on our issue tracker on GitHub.
The MIT License (MIT). Please see License File for more information.