A comprehensive and easy-to-use Node SDK, designed to simplify interactions with the WHMCS API and streamline your development process.
To install the WHMCS SDK, use your preferred package manager:
npm install whmcs-sdk
bun install whmcs-sdk
yarn install whmcs-sdk
There is a variety of pre-made functions you can use to help make your experience more seamless.
call
but appends Get
to the name.call
but appends Add
to the name.call
but appends Update
to the name.call
but appends Delete
to the name.The "action" (string) is the name of a WHMCS API Index name. The "options" (object) of any parameters you want to pass in.
To use the module you will first need to import it:
import { whmcsApi } from 'whmcs-sdk';
you can then instantiate a new client with options:
const whmcs = new whmcsApi({
host: 'yourwebsite.com',
identifier: 'api identifier',
secret: 'api secret'
//endpoint: 'includes/api.php', //only required if you changed the api.php location
});
whmcs.call('DomainWhois', {
domain: 'whmcs.com'
}, function (err, res, body) {
if (err) return console.log('Error:', err);
console.log('Domain information:', body);
});
whmcs.get('Servers')
.then(servers => console.log('Servers:' servers))
.catch(err => console.error('Error:', err));