Registry / messaging / smsglobal

smsglobal

JSON →
library1.2.5jsnpmunverified

SDK for the SMSGlobal REST API (version 1.2.5) allowing Node.js applications to send SMS, manage outgoing/incoming messages, and handle OTP verification. The library requires API credentials (key and secret) and returns promises or supports callbacks. It is designed for Node.js >=9 and is actively maintained with weekly releases. Compared to generic HTTP clients, it provides a higher-level abstraction with built-in OTP support and automatic promise wrapping.

npm install smsglobal
INSTALL
IMPORT
SIG · SMSGLOBAL
S
smsglobal
messagingjavascriptv1.2.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

smsglobal
import smsglobal from 'smsglobal'; const client = smsglobal(apiKey, apiSecret);
const smsglobal = require('smsglobal'); const client = smsglobal(apiKey, apiSecret);
The library exports a factory function. In CommonJS, you must call it immediately with credentials. ESM usage is not documented but works if supported by bundler.
smsglobal.sms.send
client.sms.send(payload, callback);
smsglobal.sms.send(payload); // missing client instance
You must first instantiate the client with API credentials before accessing .sms.send.
smsglobal.otp.send
client.otp.send(payload, callback);
const otp = require('smsglobal/otp'); otp.send(payload);
OTP methods are nested under the client instance, not a separate module.

Demonstrates installing, initializing the client with credentials, sending an SMS, and sending an OTP with both callback and promise patterns.

const apiKey = process.env.SMSGLOBAL_API_KEY ?? ''; const apiSecret = process.env.SMSGLOBAL_API_SECRET ?? ''; const smsglobal = require('smsglobal'); const client = smsglobal(apiKey, apiSecret); // Send an SMS const payload = { origin: 'SMSGlobal', destination: '61400000000', message: 'Hello from SMSGlobal SDK!' }; client.sms.send(payload, (err, res) => { if (err) console.error(err); else console.log('SMS sent:', res); }); // Send OTP const otpPayload = { origin: 'SMSGlobal', destination: '61400000000', message: '{*code*} is your verification code.' }; client.otp.send(otpPayload, (err, res) => { if (err) console.error(err); else console.log('OTP sent:', res.data); });
Debug
Known issues
gotchaThe library returns a factory function, not a class. Forgetting to call it with credentials leads to undefined errors.
fix
Always invoke the default export with apiKey and apiSecret: const client = require('smsglobal')(apiKey, secret);
affects: >=1.0.0
gotchaOTP payload must include placeholder {*code*} in the message. Otherwise validation fails with 400 error.
fix
Ensure your message string contains '{*code*}' exactly.
affects: >=1.0.0
backwards-incompatibleFrom version 1.x, promises are returned if no callback is provided. In older versions (0.x) the behavior might differ.
fix
Either provide a callback or handle the returned promise.
affects: >=1.0.0
deprecatedThe package requires Node >=9. No longer receiving updates for older Node versions.
fix
Upgrade Node to >=9 or pin to an older version of the package.
affects: >=1.2.0
Errors
Common errors & fixes
TypeError: smsglobal is not a function
Importing the module but not calling it as a factory function.
fix
Use const client = require('smsglobal')(apiKey, apiSecret);
UnhandledPromiseRejectionWarning: Error: [400] Bad Request - Message template should contain a placeholder for code i.e. {*code*}.
OTP message missing the {*code*} placeholder.
fix
Add '{*code*}' to the message string.
TypeError: Cannot read property 'send' of undefined
Requiring the module without calling it as a function returns an object with undefined nested methods.
fix
Invoke the factory: const client = require('smsglobal')(apiKey, secret); then use client.sms.send.
Upgrade
Version history
1.2.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
Amazon
1
OpenAI (training)
1
Resources
smsglobal — npm install smsglobal · libregistry