{"id":49306,"library":"sendpulse-api","title":"SendPulse API Client","description":"A simple Node.js REST client library for the SendPulse email marketing and messaging API. Current stable version is 1.1.7. The library provides methods to manage address books, send emails, and interact with other SendPulse features. It is maintained by SendPulse but has low release cadence. Compared to alternatives like nodemailer, this library is official and simplifies authentication via API user ID and secret. However, it uses a callback-based API and stores tokens on disk, which may require adaptation for modern async patterns.","status":"active","version":"1.1.7","language":"javascript","source_language":"en","source_url":"https://github.com/sendpulse/sendpulse-rest-api-node.js","tags":["javascript","sendpulse","api"],"install":[{"cmd":"npm install sendpulse-api","lang":"bash","label":"npm"},{"cmd":"yarn add sendpulse-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add sendpulse-api","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-compatible; default import provides the main module.","wrong":"const sendpulse = require('sendpulse-api')","symbol":"sendpulse","correct":"import sendpulse from 'sendpulse-api'"},{"note":"init requires exactly 4 arguments: userId, secret, tokenStoragePath, callback. Omitting tokenStoragePath causes token not found errors.","wrong":"sendpulse.init(API_USER_ID, API_SECRET, callback)","symbol":"init","correct":"sendpulse.init(API_USER_ID, API_SECRET, TOKEN_STORAGE, callback)"},{"note":"All methods are callback-based and require a callback function to handle the response.","wrong":"sendpulse.listAddressBooks()","symbol":"listAddressBooks","correct":"sendpulse.listAddressBooks(callback)"},{"note":"Callback is mandatory; omitting it will cause a runtime error.","wrong":"sendpulse.addAddressBook(bookName)","symbol":"addAddressBook","correct":"sendpulse.addAddressBook(bookName, callback)"}],"quickstart":{"code":"import sendpulse from 'sendpulse-api';\nconst API_USER_ID = process.env.SENDPULSE_USER_ID ?? '';\nconst API_SECRET = process.env.SENDPULSE_SECRET ?? '';\nconst TOKEN_STORAGE = '/tmp/';\nsendpulse.init(API_USER_ID, API_SECRET, TOKEN_STORAGE, () => {\n  sendpulse.listAddressBooks((err, data) => {\n    if (err) console.error(err);\n    else console.log('Address books:', data);\n  });\n});","lang":"javascript","description":"Initialize the client and list address books. Requires API credentials from SendPulse settings. Uses a callback to handle the response."},"warnings":[{"fix":"Use a writable directory like /tmp or an absolute path. Alternatively, implement custom token storage by modifying the library.","message":"TOKEN_STORAGE path must be writable; if using a read-only filesystem (e.g., some serverless environments), the library fails to store the access token.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Wrap calls in a Promise manually or use util.promisify from Node.js core.","message":"All methods use callbacks; no promise or async/await support. This leads to callback hell in complex workflows.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Check the 'error' parameter in callback; it may contain a parsed error object with status code and message.","message":"The library does not return the raw HTTP response; it parses JSON internally and passes only the parsed data to the callback. Error handling may miss HTTP status codes.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'1.1.7':22 'adapt':83 'address':29 'altern':51 'api':2,17,62,74,90 'async':86 'authent':60 'base':73 'book':30 'cadenc':48 'callback':72 'callback-bas':71 'client':3,8 'compar':49 'current':18 'disk':79 'email':13,32 'featur':38 'howev':67 'id':64 'interact':34 'javascript':88 'librari':9,24,55 'like':52 'low':46 'maintain':41 'manag':28 'market':14 'may':81 'messag':16 'method':26 'modern':85 'node.js':6 'nodemail':53 'offici':57 'pattern':87 'provid':25 'releas':47 'requir':82 'rest':7 'secret':66 'send':31 'sendpuls':1,12,37,43,89 'simpl':5 'simplifi':59 'stabl':19 'store':76 'token':77 'use':69 'user':63 'version':20 'via':61","created_at":"2026-06-07T17:01:05.926821+00:00","updated_at":"2026-06-07T17:01:05.926821+00:00","problems":[{"fix":"Ensure TOKEN_STORAGE points to a writable directory; e.g., '/tmp/' on Unix systems.","cause":"TOKEN_STORAGE path is incorrect or not writable. The library tries to read a cached token file.","error":"Error: Token not found"},{"fix":"Always provide a callback function as the last argument to methods like listAddressBooks(callback).","cause":"Omitting the callback function when calling an API method.","error":"TypeError: callback is not a function"}],"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/sendpulse/sendpulse-rest-api-node.js","github":"https://github.com/sendpulse/sendpulse-rest-api-node.js","docs":null,"changelog":null,"pypi":null,"npm":"sendpulse-api","openapi_spec":null,"status_page":null,"smithery":null,"categories":["communication"],"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}}