Registry / messaging / clicksend

clicksend

JSON →
library5.1.7jsnpmunverified

Official ClickSend v3 REST API SDK for Node.js (v5.1.7). Provides programmatic access to ClickSend SMS, email, voice, and fax services with built-in TypeScript definitions. Released regularly, this SDK requires Node.js v12+ and uses basic authentication. It is the primary integration method for ClickSend services, offering a straightforward promise-based API. Key differentiators include full coverage of ClickSend REST API endpoints, TypeScript support, and simple installation via npm.

npm install clicksend
INSTALL
IMPORT
SIG · CLICKSEND
C
clicksend
messagingjavascriptv5.1.7
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.

SMSApi
import { SMSApi } from 'clicksend';
const { SMSApi } = require('clicksend');
The SDK uses named exports. In CommonJS, you must use the entire module object: const ClickSend = require('clicksend'); const SMSApi = ClickSend.SMSApi;
SmsMessage
import { SmsMessage } from 'clicksend';
const SmsMessage = require('clicksend').SmsMessage;
SmsMessage is a named export. In CommonJS, destructure from require('clicksend') or use ClickSend.SmsMessage.
SmsMessageCollection
import { SmsMessageCollection } from 'clicksend';
SmsMessageCollection is a named export used to wrap multiple SmsMessage objects for sending.

Demonstrates sending an SMS via ClickSend using ESM imports, environment variables for credentials, and promise handling.

import { SMSApi, SmsMessage, SmsMessageCollection } from 'clicksend'; const smsApi = new SMSApi(); smsApi.authentications.BasicAuth.username = process.env.CLICKSEND_USERNAME ?? ''; smsApi.authentications.BasicAuth.password = process.env.CLICKSEND_API_KEY ?? ''; const smsMessage = new SmsMessage(); smsMessage.to = '+1234567890'; smsMessage.body = 'Hello from ClickSend!'; const smsCollection = new SmsMessageCollection(); smsCollection.messages = [smsMessage]; smsApi.smsSendPost(smsCollection) .then((response) => { console.log('SMS sent:', response); }) .catch((error) => { console.error('Error:', error.message); });
Debug
Known issues
gotchaAuthentication requires both username and password fields on the BasicAuth object, not an API key header or bearer token.
fix
Set smsApi.authentications.BasicAuth.username and smsApi.authentications.BasicAuth.password with your ClickSend username and API key.
affects: >=0.0.0
gotchaThe SMS message 'to' field must be in E.164 international format including leading '+'.
fix
Ensure phone numbers start with '+' followed by country code and number.
affects: >=0.0.0
breakingESM import syntax (import { SMSApi } from 'clicksend') may not work with certain bundlers or older TypeScript configurations without esModuleInterop.
fix
Use CommonJS require() or enable esModuleInterop in tsconfig.json.
affects: >=5.0.0
gotchaThe SMSApi class methods return promises; omitting .catch() can lead to unhandled promise rejections.
fix
Always attach .catch() or use async/await with try-catch.
affects: >=0.0.0
deprecatedPrevious versions used a different authentication scheme; ensure you are using BasicAuth with username and password.
fix
Update to the latest SDK and set authentications.BasicAuth.username and password.
affects: <5.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'BasicAuth')
Authentication object is not initialized or the SDK was not properly imported.
fix
Ensure you create a new SMSApi instance before accessing authentications: const smsApi = new SMSApi(); then smsApi.authentications.BasicAuth.username = ...;
Error: Request failed with status code 401
Invalid or missing ClickSend credentials (username/api key).
fix
Verify your username and API key in the ClickSend dashboard and set them correctly on the BasicAuth object.
ReferenceError: ClickSend is not defined
Using global ClickSend object without importing the module.
fix
Use const ClickSend = require('clicksend'); at the top of your file.
Upgrade
Version history
5.1.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
38 hits · last 30 days
node
36
Amazon
1
OpenAI (training)
1
Resources
clicksend — npm install clicksend · libregistry