{"id":47259,"library":"clicksend","title":"ClickSend Node.js SDK","description":"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.","status":"active","version":"5.1.7","language":"javascript","source_language":"en","source_url":"https://github.com/ClickSend/clicksend-nodejs","tags":["javascript","SMS","typescript"],"install":[{"cmd":"npm install clicksend","lang":"bash","label":"npm"},{"cmd":"yarn add clicksend","lang":"bash","label":"yarn"},{"cmd":"pnpm add clicksend","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The SDK uses named exports. In CommonJS, you must use the entire module object: const ClickSend = require('clicksend'); const SMSApi = ClickSend.SMSApi;","wrong":"const { SMSApi } = require('clicksend');","symbol":"SMSApi","correct":"import { SMSApi } from 'clicksend';"},{"note":"SmsMessage is a named export. In CommonJS, destructure from require('clicksend') or use ClickSend.SmsMessage.","wrong":"const SmsMessage = require('clicksend').SmsMessage;","symbol":"SmsMessage","correct":"import { SmsMessage } from 'clicksend';"},{"note":"SmsMessageCollection is a named export used to wrap multiple SmsMessage objects for sending.","symbol":"SmsMessageCollection","correct":"import { SmsMessageCollection } from 'clicksend';"}],"quickstart":{"code":"import { SMSApi, SmsMessage, SmsMessageCollection } from 'clicksend';\n\nconst smsApi = new SMSApi();\nsmsApi.authentications.BasicAuth.username = process.env.CLICKSEND_USERNAME ?? '';\nsmsApi.authentications.BasicAuth.password = process.env.CLICKSEND_API_KEY ?? '';\n\nconst smsMessage = new SmsMessage();\nsmsMessage.to = '+1234567890';\nsmsMessage.body = 'Hello from ClickSend!';\n\nconst smsCollection = new SmsMessageCollection();\nsmsCollection.messages = [smsMessage];\n\nsmsApi.smsSendPost(smsCollection)\n  .then((response) => { console.log('SMS sent:', response); })\n  .catch((error) => { console.error('Error:', error.message); });","lang":"typescript","description":"Demonstrates sending an SMS via ClickSend using ESM imports, environment variables for credentials, and promise handling."},"warnings":[{"fix":"Set smsApi.authentications.BasicAuth.username and smsApi.authentications.BasicAuth.password with your ClickSend username and API key.","message":"Authentication requires both username and password fields on the BasicAuth object, not an API key header or bearer token.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure phone numbers start with '+' followed by country code and number.","message":"The SMS message 'to' field must be in E.164 international format including leading '+'.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use CommonJS require() or enable esModuleInterop in tsconfig.json.","message":"ESM import syntax (import { SMSApi } from 'clicksend') may not work with certain bundlers or older TypeScript configurations without esModuleInterop.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Always attach .catch() or use async/await with try-catch.","message":"The SMSApi class methods return promises; omitting .catch() can lead to unhandled promise rejections.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Update to the latest SDK and set authentications.BasicAuth.username and password.","message":"Previous versions used a different authentication scheme; ensure you are using BasicAuth with username and password.","severity":"deprecated","affected_versions":"<5.0.0"}],"env_vars":null,"search_vec":"'access':15 'api':8,56,65 'authent':40 'base':55 'basic':39 'built':26 'built-in':25 'clicksend':1,5,17,48,63 'coverag':61 'definit':29 'differenti':58 'email':19 'endpoint':66 'fax':22 'full':60 'includ':59 'instal':71 'integr':45 'javascript':74 'key':57 'method':46 'node.js':2,11,35 'npm':73 'offer':50 'offici':4 'primari':44 'programmat':14 'promis':54 'promise-bas':53 'provid':13 'regular':31 'releas':30 'requir':34 'rest':7,64 'sdk':3,9,33 'servic':23,49 'simpl':70 'sms':18,75 'straightforward':52 'support':68 'typescript':28,67,76 'use':38 'v12':36 'v3':6 'v5.1.7':12 'via':72 'voic':20","created_at":"2026-06-07T16:50:36.607220+00:00","updated_at":"2026-06-07T16:50:36.607220+00:00","problems":[{"fix":"Ensure you create a new SMSApi instance before accessing authentications: const smsApi = new SMSApi(); then smsApi.authentications.BasicAuth.username = ...;","cause":"Authentication object is not initialized or the SDK was not properly imported.","error":"TypeError: Cannot read properties of undefined (reading 'BasicAuth')"},{"fix":"Verify your username and API key in the ClickSend dashboard and set them correctly on the BasicAuth object.","cause":"Invalid or missing ClickSend credentials (username/api key).","error":"Error: Request failed with status code 401"},{"fix":"Use const ClickSend = require('clicksend'); at the top of your file.","cause":"Using global ClickSend object without importing the module.","error":"ReferenceError: ClickSend is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ClickSend/clicksend-nodejs#readme","github":"https://github.com/ClickSend/clicksend-nodejs","docs":null,"changelog":null,"pypi":null,"npm":"clicksend","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}